Changeset 74 for UI/ui_lua.cpp
- Timestamp:
- 11/01/09 12:32:25 (4 years ago)
- File:
-
- 1 edited
-
UI/ui_lua.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
UI/ui_lua.cpp
r69 r74 71 71 int UI_Lua::newButton(lua_State *luaVM){ 72 72 int n = lua_gettop(luaVM); // Number of arguments 73 if ( n != 6)74 return luaL_error(luaVM, "Got %d arguments expected 5 (class, x, y, w, h, caption)", n);73 if ( (n != 6) && (n != 7) ) 74 return luaL_error(luaVM, "Got %d arguments expected 6 or 7 (class, x, y, w, h, caption [Lua_code])", n); 75 75 76 76 double x = luaL_checknumber (luaVM, 2); … … 79 79 double h = luaL_checknumber (luaVM, 5); 80 80 string caption = luaL_checkstring (luaVM, 6); 81 string code = ""; 82 if(n==7) code = luaL_checkstring (luaVM, 7); 81 83 82 84 // Allocate memory for a pointer to object 83 85 Button **button= (Button**)lua_newuserdata(luaVM, sizeof(Button*)); 84 *button = new Button(x,y,w,h,caption );86 *button = new Button(x,y,w,h,caption,code); 85 87 86 88 // Note: We're not putting this button anywhere!
Note: See TracChangeset
for help on using the changeset viewer.