Interpreter.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef ROCKETCORELUAINTERPRETER_H
  2. #define ROCKETCORELUALUATYPE_H
  3. /*
  4. This initializes the lua interpreter, and has functions to load the scripts
  5. A glorified namespace, but I want the lua_State to be unchangeable
  6. */
  7. #include "Header.h"
  8. #include <Rocket/Core/Lua/lua.hpp>
  9. #include <Rocket/Core/Plugin.h>
  10. namespace Rocket {
  11. namespace Core {
  12. namespace Lua {
  13. class ROCKETLUA_API Interpreter : public Plugin
  14. {
  15. public:
  16. static void LoadFile(const Rocket::Core::String& file);
  17. static void DoString(const Rocket::Core::String& str);
  18. static void Report();
  19. static void BeginCall(int funRef);
  20. static bool ExecuteCall(int params = 0, int res = 0);
  21. static void EndCall(int res = 0);
  22. static lua_State* GetLuaState();
  23. static void Initialise();
  24. static void Shutdown();
  25. //From Plugin
  26. virtual int GetEventClasses();
  27. virtual void OnInitialise();
  28. virtual void OnShutdown();
  29. private:
  30. //This will populate the global Lua table with all of the Lua types and some global functions
  31. static inline void RegisterEverything(lua_State* L);
  32. void Startup();
  33. static lua_State* _L;
  34. };
  35. }
  36. }
  37. }
  38. #endif