mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Push musname_size and musname to Lua (correctly, this time)
This commit is contained in:
parent
79a921f59b
commit
3ad0b6fd96
1 changed files with 20 additions and 2 deletions
|
|
@ -2508,12 +2508,22 @@ static int mapheaderinfo_get(lua_State *L)
|
|||
lua_pushinteger(L, header->typeoflevel);
|
||||
else if (fastcmp(field,"keywords"))
|
||||
lua_pushstring(L, header->keywords);
|
||||
else if (fastcmp(field,"musname"))
|
||||
lua_pushstring(L, header->musname);
|
||||
else if (fastcmp(field,"musname")) // we create a table here because it saves us from a userdata nightmare
|
||||
{
|
||||
UINT8 i;
|
||||
lua_createtable(L, header->musname_size, 0);
|
||||
for (i = 0; i < header->musname_size; i++)
|
||||
{
|
||||
lua_pushstring(L, header->musname[i]);
|
||||
lua_rawseti(L, -2, 1 + i);
|
||||
}
|
||||
}
|
||||
else if (fastcmp(field,"mustrack"))
|
||||
lua_pushinteger(L, header->mustrack);
|
||||
else if (fastcmp(field,"muspos"))
|
||||
lua_pushinteger(L, header->muspos);
|
||||
else if (fastcmp(field,"musname_size"))
|
||||
lua_pushinteger(L, header->musname_size);
|
||||
else if (fastcmp(field,"weather"))
|
||||
lua_pushinteger(L, header->weather);
|
||||
else if (fastcmp(field,"skytexture"))
|
||||
|
|
@ -2774,6 +2784,14 @@ int LUA_MapLib(lua_State *L)
|
|||
//lua_pushcfunction(L, mapheaderinfo_num);
|
||||
//lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);
|
||||
|
||||
/* luaL_newmetatable(L, META_MUSNAME);
|
||||
lua_pushcfunction(L, musname_get);
|
||||
lua_setfield(L, -2, "__index");
|
||||
|
||||
lua_pushcfunction(L, musname_len);
|
||||
lua_setfield(L, -2, "__len");
|
||||
lua_pop(L, 1);*/
|
||||
|
||||
luaL_newmetatable(L, META_ACTIVATOR);
|
||||
lua_pushcfunction(L, activator_get);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue