diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2013-02-16 14:49:05 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2013-02-16 14:49:05 (GMT) |
| commit | 8d04b260a7966a31919e9b8dae8da852a47d9313 (patch) | |
| tree | c2a9e7e2686a6e29a40076082eb8809c7fbb2a8c /src/cat/LuaScriptInterface.cpp | |
| parent | 01cd146ee910fb9e62859583842c9842b539565b (diff) | |
| download | powder-8d04b260a7966a31919e9b8dae8da852a47d9313.zip powder-8d04b260a7966a31919e9b8dae8da852a47d9313.tar.gz | |
Add missing removeComponent for Lua API
Diffstat (limited to 'src/cat/LuaScriptInterface.cpp')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index a3fe00b..cb46ca4 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -341,6 +341,7 @@ void LuaScriptInterface::initInterfaceAPI() {"showWindow", interface_showWindow}, {"closeWindow", interface_closeWindow}, {"addComponent", interface_addComponent}, + {"removeComponent", interface_addComponent}, {NULL, NULL} }; luaL_register(l, "interface", interfaceAPIMethods); @@ -381,6 +382,29 @@ int LuaScriptInterface::interface_addComponent(lua_State * l) return 0; } +int LuaScriptInterface::interface_removeComponent(lua_State * l) +{ + void * luaComponent = NULL; + ui::Component * component = NULL; + if(luaComponent = Luna<LuaButton>::tryGet(l, 1)) + component = Luna<LuaButton>::get(luaComponent)->GetComponent(); + else if(luaComponent = Luna<LuaLabel>::tryGet(l, 1)) + component = Luna<LuaLabel>::get(luaComponent)->GetComponent(); + else if(luaComponent = Luna<LuaTextbox>::tryGet(l, 1)) + component = Luna<LuaTextbox>::get(luaComponent)->GetComponent(); + else if(luaComponent = Luna<LuaCheckbox>::tryGet(l, 1)) + component = Luna<LuaCheckbox>::get(luaComponent)->GetComponent(); + else if(luaComponent = Luna<LuaSlider>::tryGet(l, 1)) + component = Luna<LuaSlider>::get(luaComponent)->GetComponent(); + else if(luaComponent = Luna<LuaProgressBar>::tryGet(l, 1)) + component = Luna<LuaProgressBar>::get(luaComponent)->GetComponent(); + else + luaL_typerror(l, 1, "Component"); + if(luacon_ci->Window && component) + luacon_ci->Window->RemoveComponent(component); + return 0; +} + int LuaScriptInterface::interface_showWindow(lua_State * l) { LuaWindow * window = Luna<LuaWindow>::check(l, 1); |
