expose new include_prefix param to Lua

develop
Myk Taylor 2020-07-19 01:52:57 -07:00
parent 16cfd34678
commit d0f8ba06a2
1 changed files with 4 additions and 1 deletions

@ -2406,8 +2406,11 @@ static int filesystem_listdir_recursive(lua_State *L)
int depth = 10; int depth = 10;
if (lua_type(L, 2) == LUA_TNUMBER) if (lua_type(L, 2) == LUA_TNUMBER)
depth = lua_tounsigned(L, 2); depth = lua_tounsigned(L, 2);
bool include_prefix = true;
if (lua_type(L, 3) == LUA_TBOOLEAN)
include_prefix = lua_toboolean(L, 3);
std::map<std::string, bool> files; std::map<std::string, bool> files;
int err = DFHack::Filesystem::listdir_recursive(dir, files, depth); int err = DFHack::Filesystem::listdir_recursive(dir, files, depth, include_prefix);
if (err) if (err)
{ {
lua_pushnil(L); lua_pushnil(L);