#include extern "C" { #include #include #include } // {{startx, starty},{endx,endy}} lua_torecti(lua_State* L, int number, int* sx, int* sy, int* ex, int* ey){ lua_pushnumber(L,1);// ...,{},...,1 lua_gettable(L,number);// ...,{{sx,sy},{ex,ey}},...,{sx,sy} lua_pushnumber(L,1);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},1 lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},sx *sx = lua_tonumber(L,-1);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},sx lua_pop(1);// ...,{{sx,sy},{ex,ey}},...,{sx,sy} lua_pushnumber(L,2);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},2 lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{sx,sy},sy *sy = lua_tonumber(L,-1); lua_pop(2);// ...,{{sx,sy},{ex,ey}},... lua_pushnumber(L,2);// ...,{{sx,sy},{ex,ey}},...,2 lua_gettable(L,number);// ...,{{sx,sy},{ex,ey}},...,{ex,ey} lua_pushnumber(L,1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},1 lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ex *ex = lua_tonumber(L,-1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ex lua_pop(L,1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey} lua_pushnumber(L,2);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},2 lua_gettable(L,-2);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ey *ey = lua_tonumber(L,-1);// ...,{{sx,sy},{ex,ey}},...,{ex,ey},ey lua_pop(L,2);// ...,{{sx,sy},{ex,ey}},... } int addIGUIButton(lua_State* L){ IGUIEnvironment env = lua_touserdata(L,1); IGUIElement parent = lua_touserdata(L,2); s32 id = lua_tonumber(L,3); s32 sx,sy,ex,ey; lua_torecti(L,4,&sx,&sy,&ex,&ey); core::rect rect = core::rect(sx,sy,ex,ey); IGUIElement* button = env->addButton(rect,parent,id, } void add_gui(lua_State* L){ }