/gameplay/src/lua/lua_ScriptTargetEventRegistry.cpp
https://github.com/blackberry/GamePlay · C++ · 322 lines · 270 code · 35 blank · 17 comment · 40 complexity · d4268c6d6c0acf443f5967349c782a77 MD5 · raw file
- // Autogenerated by gameplay-luagen
- #include "Base.h"
- #include "ScriptController.h"
- #include "lua_ScriptTargetEventRegistry.h"
- #include "AnimationClip.h"
- #include "Base.h"
- #include "Button.h"
- #include "CheckBox.h"
- #include "Container.h"
- #include "Control.h"
- #include "Form.h"
- #include "ImageControl.h"
- #include "Joint.h"
- #include "JoystickControl.h"
- #include "Label.h"
- #include "Node.h"
- #include "PhysicsController.h"
- #include "RadioButton.h"
- #include "ScriptController.h"
- #include "ScriptTarget.h"
- #include "Slider.h"
- #include "TextBox.h"
- #include "Transform.h"
- namespace gameplay
- {
- static ScriptTarget::EventRegistry* getInstance(lua_State* state)
- {
- void* userdata = luaL_checkudata(state, 1, "ScriptTargetEventRegistry");
- luaL_argcheck(state, userdata != NULL, 1, "'ScriptTargetEventRegistry' expected.");
- return (ScriptTarget::EventRegistry*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
- }
- static int lua_ScriptTargetEventRegistry__gc(lua_State* state)
- {
- // Get the number of parameters.
- int paramCount = lua_gettop(state);
- // Attempt to match the parameters to a valid binding.
- switch (paramCount)
- {
- case 1:
- {
- if ((lua_type(state, 1) == LUA_TUSERDATA))
- {
- void* userdata = luaL_checkudata(state, 1, "ScriptTargetEventRegistry");
- luaL_argcheck(state, userdata != NULL, 1, "'ScriptTargetEventRegistry' expected.");
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
- if (object->owns)
- {
- ScriptTarget::EventRegistry* instance = (ScriptTarget::EventRegistry*)object->instance;
- SAFE_DELETE(instance);
- }
-
- return 0;
- }
- lua_pushstring(state, "lua_ScriptTargetEventRegistry__gc - Failed to match the given parameters to a valid function signature.");
- lua_error(state);
- break;
- }
- default:
- {
- lua_pushstring(state, "Invalid number of parameters (expected 1).");
- lua_error(state);
- break;
- }
- }
- return 0;
- }
- static int lua_ScriptTargetEventRegistry__init(lua_State* state)
- {
- // Get the number of parameters.
- int paramCount = lua_gettop(state);
- // Attempt to match the parameters to a valid binding.
- switch (paramCount)
- {
- case 0:
- {
- void* returnPtr = ((void*)new ScriptTarget::EventRegistry());
- if (returnPtr)
- {
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
- object->instance = returnPtr;
- object->owns = true;
- luaL_getmetatable(state, "ScriptTargetEventRegistry");
- lua_setmetatable(state, -2);
- }
- else
- {
- lua_pushnil(state);
- }
- return 1;
- break;
- }
- default:
- {
- lua_pushstring(state, "Invalid number of parameters (expected 0).");
- lua_error(state);
- break;
- }
- }
- return 0;
- }
- static int lua_ScriptTargetEventRegistry_addEvent(lua_State* state)
- {
- // Get the number of parameters.
- int paramCount = lua_gettop(state);
- // Attempt to match the parameters to a valid binding.
- switch (paramCount)
- {
- case 2:
- {
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
- (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
- {
- // Get parameter 1 off the stack.
- const char* param1 = gameplay::ScriptUtil::getString(2, false);
- ScriptTarget::EventRegistry* instance = getInstance(state);
- void* returnPtr = ((void*)instance->addEvent(param1));
- if (returnPtr)
- {
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
- object->instance = returnPtr;
- object->owns = false;
- luaL_getmetatable(state, "ScriptTargetEvent");
- lua_setmetatable(state, -2);
- }
- else
- {
- lua_pushnil(state);
- }
- return 1;
- }
- lua_pushstring(state, "lua_ScriptTargetEventRegistry_addEvent - Failed to match the given parameters to a valid function signature.");
- lua_error(state);
- break;
- }
- case 3:
- {
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
- (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
- (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
- {
- // Get parameter 1 off the stack.
- const char* param1 = gameplay::ScriptUtil::getString(2, false);
- // Get parameter 2 off the stack.
- const char* param2 = gameplay::ScriptUtil::getString(3, false);
- ScriptTarget::EventRegistry* instance = getInstance(state);
- void* returnPtr = ((void*)instance->addEvent(param1, param2));
- if (returnPtr)
- {
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
- object->instance = returnPtr;
- object->owns = false;
- luaL_getmetatable(state, "ScriptTargetEvent");
- lua_setmetatable(state, -2);
- }
- else
- {
- lua_pushnil(state);
- }
- return 1;
- }
- lua_pushstring(state, "lua_ScriptTargetEventRegistry_addEvent - Failed to match the given parameters to a valid function signature.");
- lua_error(state);
- break;
- }
- default:
- {
- lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
- lua_error(state);
- break;
- }
- }
- return 0;
- }
- static int lua_ScriptTargetEventRegistry_getEvent(lua_State* state)
- {
- // Get the number of parameters.
- int paramCount = lua_gettop(state);
- // Attempt to match the parameters to a valid binding.
- switch (paramCount)
- {
- case 2:
- {
- do
- {
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
- lua_type(state, 2) == LUA_TNUMBER)
- {
- // Get parameter 1 off the stack.
- unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
- ScriptTarget::EventRegistry* instance = getInstance(state);
- void* returnPtr = ((void*)instance->getEvent(param1));
- if (returnPtr)
- {
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
- object->instance = returnPtr;
- object->owns = false;
- luaL_getmetatable(state, "ScriptTargetEvent");
- lua_setmetatable(state, -2);
- }
- else
- {
- lua_pushnil(state);
- }
- return 1;
- }
- } while (0);
- do
- {
- if ((lua_type(state, 1) == LUA_TUSERDATA) &&
- (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
- {
- // Get parameter 1 off the stack.
- const char* param1 = gameplay::ScriptUtil::getString(2, false);
- ScriptTarget::EventRegistry* instance = getInstance(state);
- void* returnPtr = ((void*)instance->getEvent(param1));
- if (returnPtr)
- {
- gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
- object->instance = returnPtr;
- object->owns = false;
- luaL_getmetatable(state, "ScriptTargetEvent");
- lua_setmetatable(state, -2);
- }
- else
- {
- lua_pushnil(state);
- }
- return 1;
- }
- } while (0);
- lua_pushstring(state, "lua_ScriptTargetEventRegistry_getEvent - Failed to match the given parameters to a valid function signature.");
- lua_error(state);
- break;
- }
- default:
- {
- lua_pushstring(state, "Invalid number of parameters (expected 2).");
- lua_error(state);
- break;
- }
- }
- return 0;
- }
- static int lua_ScriptTargetEventRegistry_getEventCount(lua_State* state)
- {
- // Get the number of parameters.
- int paramCount = lua_gettop(state);
- // Attempt to match the parameters to a valid binding.
- switch (paramCount)
- {
- case 1:
- {
- if ((lua_type(state, 1) == LUA_TUSERDATA))
- {
- ScriptTarget::EventRegistry* instance = getInstance(state);
- unsigned int result = instance->getEventCount();
- // Push the return value onto the stack.
- lua_pushunsigned(state, result);
- return 1;
- }
- lua_pushstring(state, "lua_ScriptTargetEventRegistry_getEventCount - Failed to match the given parameters to a valid function signature.");
- lua_error(state);
- break;
- }
- default:
- {
- lua_pushstring(state, "Invalid number of parameters (expected 1).");
- lua_error(state);
- break;
- }
- }
- return 0;
- }
- void luaRegister_ScriptTargetEventRegistry()
- {
- const luaL_Reg lua_members[] =
- {
- {"addEvent", lua_ScriptTargetEventRegistry_addEvent},
- {"getEvent", lua_ScriptTargetEventRegistry_getEvent},
- {"getEventCount", lua_ScriptTargetEventRegistry_getEventCount},
- {NULL, NULL}
- };
- const luaL_Reg* lua_statics = NULL;
- std::vector<std::string> scopePath;
- scopePath.push_back("ScriptTarget");
- gameplay::ScriptUtil::registerClass("ScriptTargetEventRegistry", lua_members, lua_ScriptTargetEventRegistry__init, lua_ScriptTargetEventRegistry__gc, lua_statics, scopePath);
- }
- }