mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Allow Fixture:setUserData and Fixture:getUserData to be called in coroutines (resolves issue #850.)
Bad things will still happen if you call them from a love Thread which didn't create the World and the Fixture object. Don't do it!
This commit is contained in:
@@ -64,21 +64,31 @@ void Reference::unref()
|
||||
}
|
||||
}
|
||||
|
||||
void Reference::push()
|
||||
void Reference::push(lua_State *newL)
|
||||
{
|
||||
if (idx != LUA_REFNIL)
|
||||
{
|
||||
luax_insist(L, LUA_REGISTRYINDEX, REFERENCE_TABLE_NAME);
|
||||
lua_rawgeti(L, -1, idx);
|
||||
lua_remove(L, -2);
|
||||
luax_insist(newL, LUA_REGISTRYINDEX, REFERENCE_TABLE_NAME);
|
||||
lua_rawgeti(newL, -1, idx);
|
||||
lua_remove(newL, -2);
|
||||
}
|
||||
else
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(newL);
|
||||
}
|
||||
|
||||
lua_State *Reference::getL()
|
||||
void Reference::push()
|
||||
{
|
||||
push(L);
|
||||
}
|
||||
|
||||
lua_State *Reference::getL() const
|
||||
{
|
||||
return L;
|
||||
}
|
||||
|
||||
void Reference::setL(lua_State *newL)
|
||||
{
|
||||
L = newL;
|
||||
}
|
||||
|
||||
} // love
|
||||
|
||||
Reference in New Issue
Block a user