Modify __tostring so it also shows a pointer, like lua does for tables

This should make it easier to identify unique objects.
Also modified internal code relying on tostring behaviour, and it should now
call its type method instead.
This commit is contained in:
Bart van Strien
2015-08-01 19:55:41 +02:00
parent 2392174eb2
commit c15f4b5f26
2 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ static love::Type extractudatatype(lua_State *L, int idx)
Type t = INVALID_ID;
if (!lua_isuserdata(L, idx))
return t;
if (luaL_getmetafield(L, idx, "__tostring") == 0)
if (luaL_getmetafield(L, idx, "type") == 0)
return t;
lua_pushvalue(L, idx);
int result = lua_pcall(L, 1, 1, 0);