Removed the callback argument from love.filesystem.getDirectoryItems (resolves issue #877.)

Cleaned up the getDirectoryItems ccde to no longer call Lua API functions from Filesystem.cpp (now it's all in wrap_Filesystem.cpp.)
This commit is contained in:
Alex Szpakowski
2015-04-25 00:16:10 -03:00
parent 289eeb4fe0
commit e7f56241ec
4 changed files with 19 additions and 28 deletions
+15 -1
View File
@@ -408,7 +408,21 @@ int w_append(lua_State *L)
int w_getDirectoryItems(lua_State *L)
{
return instance()->getDirectoryItems(L);
const char *dir = luaL_checkstring(L, 1);
std::vector<std::string> items;
instance()->getDirectoryItems(dir, items);
lua_createtable(L, (int) items.size(), 0);
for (int i = 0; i < (int) items.size(); i++)
{
lua_pushstring(L, items[i].c_str());
lua_rawseti(L, -2, i + 1);
}
// Return the table.
return 1;
}
int w_lines(lua_State *L)