MCPcopy Create free account
hub / github.com/defold/defold / LuaInit

Function LuaInit

engine/gamesys/src/gamesys/scripts/script_window.cpp:531–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

529 */
530
531static void LuaInit(lua_State* L)
532{
533 int top = lua_gettop(L);
534 luaL_register(L, "window", Module_methods);
535
536#define SETCONSTANT(name) \
537 lua_pushnumber(L, (lua_Number) name); \
538 lua_setfield(L, -2, #name);\
539
540 SETCONSTANT(WINDOW_EVENT_FOCUS_LOST)
541 SETCONSTANT(WINDOW_EVENT_FOCUS_GAINED)
542 SETCONSTANT(WINDOW_EVENT_RESIZED)
543 SETCONSTANT(WINDOW_EVENT_ICONFIED)
544 SETCONSTANT(WINDOW_EVENT_DEICONIFIED)
545
546 SETCONSTANT(DIMMING_UNKNOWN)
547 SETCONSTANT(DIMMING_ON)
548 SETCONSTANT(DIMMING_OFF)
549
550#undef SETCONSTANT
551
552 lua_pop(L, 1);
553 assert(top == lua_gettop(L));
554}
555
556void ScriptWindowRegister(const ScriptLibContext& context)
557{

Callers 1

ScriptWindowRegisterFunction · 0.70

Calls 2

lua_gettopFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected