LuaScriptLuaAPI.pkg 1.3 KB

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