Put Lua input library in its own namespace

This commit is contained in:
LJ Sonic 2021-08-13 21:58:34 +02:00
parent 1d92456ad5
commit 8adf4b672a

View file

@ -127,19 +127,19 @@ static int lib_getCursorPosition(lua_State *L)
} }
static luaL_Reg lib[] = { static luaL_Reg lib[] = {
{"G_GameControlDown", lib_gameControlDown}, {"gameControlDown", lib_gameControlDown},
{"G_GameControl2Down", lib_gameControl2Down}, {"gameControl2Down", lib_gameControl2Down},
{"G_GameControlToKeyNum", lib_gameControlToKeyNum}, {"gameControlToKeyNum", lib_gameControlToKeyNum},
{"G_GameControl2ToKeyNum", lib_gameControl2ToKeyNum}, {"gameControl2ToKeyNum", lib_gameControl2ToKeyNum},
{"G_JoyAxis", lib_joyAxis}, {"joyAxis", lib_joyAxis},
{"G_Joy2Axis", lib_joy2Axis}, {"joy2Axis", lib_joy2Axis},
{"G_KeyNumToString", lib_keyNumToString}, {"keyNumToString", lib_keyNumToString},
{"G_KeyStringToNum", lib_keyStringToNum}, {"keyStringToNum", lib_keyStringToNum},
{"HU_KeyNumPrintable", lib_keyNumPrintable}, {"keyNumPrintable", lib_keyNumPrintable},
{"HU_ShiftKeyNum", lib_shiftKeyNum}, {"shiftKeyNum", lib_shiftKeyNum},
{"I_GetMouseGrab", lib_getMouseGrab}, {"getMouseGrab", lib_getMouseGrab},
{"I_SetMouseGrab", lib_setMouseGrab}, {"setMouseGrab", lib_setMouseGrab},
{"I_GetCursorPosition", lib_getCursorPosition}, {"getCursorPosition", lib_getCursorPosition},
{NULL, NULL} {NULL, NULL}
}; };
@ -235,8 +235,6 @@ int LUA_InputLib(lua_State *L)
lua_setfield(L, -2, "__len"); lua_setfield(L, -2, "__len");
lua_pop(L, 1); lua_pop(L, 1);
// Set global functions luaL_register(L, "input", lib);
lua_pushvalue(L, LUA_GLOBALSINDEX);
luaL_register(L, NULL, lib);
return 0; return 0;
} }