1 #ifndef LUA_STATE_H__ 2 #define LUA_STATE_H__ 3 4 #define LUA_REENTRANT 5 #include <lua.hpp> 6 #include <string> 7 8 namespace mrt { 9 class Chunk; 10 } 11 12 namespace luaxx { 13 class State { 14 public: 15 State(); 16 void load(const std::string &fname, const mrt::Chunk &data); 17 void loadFile(const std::string &fname); 18 19 void open(); 20 void call(const int nargs, const int nresults) const; 21 ~State(); 22 23 inline operator lua_State*() { return state; } 24 void clear(); 25 26 private: 27 void init(); 28 lua_State * state; 29 }; 30 } 31 32 #endif 33