1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-29 00:05:50 +00:00

Add Lua functions:

+ getModName()
+ getModPath()
And fileExists() returns the normalized file name as 2nd result now.
This commit is contained in:
fgenesis 2015-08-03 20:34:31 +02:00
parent 5410028906
commit 03f47b0480

View file

@ -876,7 +876,26 @@ luaFunc(fileExists)
safePath(L, s);
std::string res;
bool there = findFile_helper(s.c_str(), res);
luaReturnBool(there);
lua_pushboolean(L, there);
lua_pushstring(L, res.c_str());
return 2;
}
luaFunc(getModName)
{
luaReturnStr(dsq->mod.isActive() ? dsq->mod.getName().c_str() : "");
}
luaFunc(getModPath)
{
std::string path;
if (dsq->mod.isActive())
{
path = dsq->mod.getPath();
if(path[path.length() - 1] != '/')
path += '/';
}
luaReturnStr(path.c_str());
}
@ -9297,6 +9316,8 @@ static const struct {
{"loadfile", l_loadfile_caseinsensitive},
luaRegister(fileExists),
luaRegister(getModName),
luaRegister(getModPath),
luaRegister(debugBreak),
luaRegister(setIgnoreAction),