Interpreter.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. //From Plugin
  25. virtual int GetEventClasses();
  26. virtual void OnInitialise();
  27. virtual void OnShutdown();
  28. private:
  29. //This will populate the global Lua table with all of the Lua types and some global functions
  30. static inline void RegisterEverything(lua_State* L);
  31. void Startup();
  32. static lua_State* _L;
  33. };
  34. }
  35. }
  36. }
  37. #endif