LuaScriptLuaAPI.pkg 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. $#define TOLUA_RELEASE
  2. $#include "LuaScript.h"
  3. void ExecuteFile(const String& fileName);
  4. void ExecuteFile(const char* fileName);
  5. Object* GetEventSender();
  6. void SendEvent(const String& eventName, VariantMap& eventData);
  7. void SendEvent(const char* eventName, VariantMap& eventData);
  8. void SubscribeToEvent(const String& eventName, const char* functionName);
  9. void SubscribeToEvent(const char* eventName, const char* functionName);
  10. void SubscribeToEvent(void* object, const String& eventName, const char* functionName);
  11. void SubscribeToEvent(void* object, const char* eventName, const char* functionName);
  12. $using namespace Urho3D;
  13. $#pragma warning(disable:4800)
  14. ${
  15. static LuaScript* GetLuaScript()
  16. {
  17. return GetContext()->GetSubsystem<LuaScript>();
  18. }
  19. static bool ExecuteFile(const String& fileName)
  20. {
  21. return GetLuaScript()->ExecuteFile(fileName);
  22. }
  23. static void SendEvent(const String& eventName, VariantMap& eventData)
  24. {
  25. GetLuaScript()->ScriptSendEvent(eventName, eventData);
  26. }
  27. static Object* GetEventSender()
  28. {
  29. return GetLuaScript()->GetEventSender();
  30. }
  31. static void SubscribeToEvent(const String& eventName, const char* functionName)
  32. {
  33. GetLuaScript()->ScriptSubscribeToEvent(eventName, functionName);
  34. }
  35. static void SubscribeToEvent(void* object, const String& eventName, const char* functionName)
  36. {
  37. GetLuaScript()->ScriptSubscribeToEvent((Object*)object, eventName, functionName);
  38. }
  39. $}