aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/iguibutton.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/lua_api/gui/iguibutton.cpp')
-rw-r--r--src/client/lua_api/gui/iguibutton.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp
index b8ff517..3d4580b 100644
--- a/src/client/lua_api/gui/iguibutton.cpp
+++ b/src/client/lua_api/gui/iguibutton.cpp
@@ -47,13 +47,17 @@ static int newiguibutton(lua_State* L){
//printf("Createing gui button!\n");
int nargs = lua_gettop(L);
+ if(nargs > 3 || nargs < 2){
+ lua_pop(L,nargs);
+ lua_pushstring(L,"Incorrect number of arguments for gui.newbutton(rect,\"text\"[,parent])");
+ lua_error(L);
+ }
IGUIElement* parent = NULL;
if(nargs == 3){
lua_getfield(L,-1,"guielement");
parent = (IGUIElement*)lua_touserdata(L,-1);
lua_pop(L,2);//{{sx,sy},{ex,ey}},"text"
}
-
const char* label_c = lua_tostring(L,-1);//{{sx,sy},{ex,ey}},"text"
size_t label_c_len = strlen(label_c);
wchar_t label_w[label_c_len + 1] = L"";