diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-31 21:02:02 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-31 21:02:02 (GMT) |
| commit | 355c43723fd7aa5c412649924c1aa9238657b8ca (patch) | |
| tree | 6860645c9f9dc5e224471af5170c578a2d13435e /src/cat/LuaScriptInterface.cpp | |
| parent | e8628274ada57b6a526e7cdb261875ac95f05db5 (diff) | |
| download | powder-355c43723fd7aa5c412649924c1aa9238657b8ca.zip powder-355c43723fd7aa5c412649924c1aa9238657b8ca.tar.gz | |
More interface API
Diffstat (limited to 'src/cat/LuaScriptInterface.cpp')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index fe098a0..54e2292 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -28,6 +28,7 @@ #include "LuaLuna.h" #include "LuaWindow.h" #include "LuaButton.h" +#include "LuaLabel.h" #ifdef WIN #include <direct.h> @@ -284,14 +285,17 @@ void LuaScriptInterface::initInterfaceAPI() luaL_register(l, "interface", interfaceAPIMethods); Luna<LuaWindow>::Register(l); Luna<LuaButton>::Register(l); + Luna<LuaLabel>::Register(l); } int LuaScriptInterface::interface_addComponent(lua_State * l) { void * luaComponent = NULL; ui::Component * component = NULL; - if(luaComponent = luaL_checkudata(l, 1, "Button")) + 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 luaL_typerror(l, 1, "Component"); if(luacon_ci->Window && component) |
