Interpreter.h 982 B

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