mirror of
https://github.com/love2d/love.git
synced 2026-08-12 16:40:57 +02:00
love get* APIs which return tables with fields can optionally accept a table argument to fill in, instead of creating a new table.
--HG-- branch : minor
This commit is contained in:
@@ -371,7 +371,10 @@ int w_getInfo(lua_State *L)
|
||||
if (!Filesystem::getConstant(info.type, typestr))
|
||||
return luaL_error(L, "Unknown file type.");
|
||||
|
||||
lua_createtable(L, 0, 3);
|
||||
if (lua_istable(L, 2))
|
||||
lua_pushvalue(L, 2);
|
||||
else
|
||||
lua_createtable(L, 0, 3);
|
||||
|
||||
lua_pushstring(L, typestr);
|
||||
lua_setfield(L, -2, "type");
|
||||
|
||||
Reference in New Issue
Block a user