lovr.filesystem.getDirectoryItems works if table.sort is unavailable;
It just doesn't sort the output.
@@ -129,9 +129,15 @@ static int l_lovrFilesystemGetDirectoryItems(lua_State* L) {
}
lua_getglobal(L, "table");
+ if (lua_type(L, -1) == LUA_TTABLE) {
lua_getfield(L, -1, "sort");
+ if (lua_type(L, -1) == LUA_TFUNCTION) {
lua_pushvalue(L, 2);
lua_call(L, 1, 0);
+ } else {
+ lua_pop(L, 1);
+ }
+ }
lua_pop(L, 1);
return 1;
}
