Exmirai Posted May 7, 2014 Share Posted May 7, 2014 as some of you know, I'm making a mod for ja like ja++ but for ui module, I need some help on lua, so to the point: I have a function menu:OnESC (I think everyone knows what it is for) when at its performing it should run another lua function ( menu1:OnESC( print('test') ), I wrote all the code, but game still crashes( Here is a code: int UILua_Menu_OnESC( lua_State *L ) { menuDef_t *menu = UILua_CheckMenu( L, 1 ); int id = menu->num; uilua_menu_t *data = UILua_Menu_Get(L, id); if ( lua_type( L, 2 ) != LUA_TFUNCTION) { trap->Print("UILua: Failed to register OnESC function "); return 1; }; data->onESC = luaL_ref( L, LUA_REGISTRYINDEX ); return 1; } void UILua_Menu_OnESC_Call( menuDef_t *menu ) { uilua_menu_t *data = UILua_Menu_Get(UILua.state, menu->num); lua_rawgeti( UILua.state, LUA_REGISTRYINDEX, data->onESC ); UILua_Call( UILua.state, 0, 0 ); }OnESC_Call function executed when "A_ESCAPE" button is pressedPlease help Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now