mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Use the same names as userdataType() for userdataMetatable()
This commit is contained in:
parent
f943f247af
commit
1155d875d5
1 changed files with 11 additions and 1 deletions
|
@ -278,8 +278,18 @@ static int lib_registerMetatable(lua_State *L)
|
|||
// Returns nil if the string does not refer to a valid userdata type
|
||||
static int lib_userdataMetatable(lua_State *L)
|
||||
{
|
||||
UINT32 i;
|
||||
const char *udname = luaL_checkstring(L, 1);
|
||||
luaL_getmetatable(L, udname);
|
||||
|
||||
// Find internal metatable name
|
||||
for (i = 0; meta2utype[i].meta; i++)
|
||||
if (!strcmp(udname, meta2utype[i].utype))
|
||||
{
|
||||
luaL_getmetatable(L, meta2utype[i].meta);
|
||||
return 1;
|
||||
}
|
||||
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue