Pass Type to luax_register_type by pointer instead of reference

Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference.

<Textmode> the best kind of behavior

--HG--
branch : dynamiccore2
This commit is contained in:
Bart van Strien
2016-11-14 21:51:47 +01:00
parent d967a755e5
commit 9f6aa716fa
54 changed files with 60 additions and 59 deletions
+5 -5
View File
@@ -307,9 +307,9 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name)
return 0;
}
int luax_register_type(lua_State *L, love::Type &type, ...)
int luax_register_type(lua_State *L, love::Type *type, ...)
{
type.init();
type->init();
// Get the place for storing and re-using instantiated love types.
luax_getregistry(L, REGISTRY_OBJECTS);
@@ -336,7 +336,7 @@ int luax_register_type(lua_State *L, love::Type &type, ...)
else
lua_pop(L, 1);
luaL_newmetatable(L, type.getName());
luaL_newmetatable(L, type->getName());
// m.__index = m
lua_pushvalue(L, -1);
@@ -351,12 +351,12 @@ int luax_register_type(lua_State *L, love::Type &type, ...)
lua_setfield(L, -2, "__eq");
// Add tostring function.
lua_pushstring(L, type.getName());
lua_pushstring(L, type->getName());
lua_pushcclosure(L, w__tostring, 1);
lua_setfield(L, -2, "__tostring");
// Add type
lua_pushstring(L, type.getName());
lua_pushstring(L, type->getName());
lua_pushcclosure(L, w__type, 1);
lua_setfield(L, -2, "type");