Add game.ui.obj
This commit is contained in:
parent
943601bc3a
commit
96da001734
12
src/luaapi.c
12
src/luaapi.c
@ -1332,6 +1332,7 @@ static int game_camfocus(lua_State *L) {
|
||||
#define MENUITEM_LABEL 1
|
||||
#define MENUITEM_TEXTBUTTON 2
|
||||
#define MENUITEM_TEXTINPUT 3
|
||||
#define MENUITEM_OBJ 4
|
||||
struct menuitem {
|
||||
int type;
|
||||
struct k3MObj *ptr;
|
||||
@ -2021,6 +2022,14 @@ static int dagame_send(lua_State *L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dagame_ui_obj(lua_State *L) {
|
||||
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
||||
item->type = MENUITEM_OBJ;
|
||||
item->ptr = (void*) k3MObj();
|
||||
luaL_setmetatable(L, "k3menuitem");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int dagame_ui_screen(lua_State *L) {
|
||||
struct menuitem *item = lua_newuserdata(L, sizeof(*item));
|
||||
item->type = MENUITEM_SCREEN;
|
||||
@ -2923,6 +2932,9 @@ void luaapi_init() {
|
||||
|
||||
k3Log(k3_DEBUG, "Creating table game.ui");
|
||||
lua_newtable(L);
|
||||
lua_pushcfunction(L, dagame_ui_obj);
|
||||
lua_setfield(L, -2, "obj");
|
||||
|
||||
lua_pushcfunction(L, dagame_ui_screen);
|
||||
lua_setfield(L, -2, "screen");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user