mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-05-10 11:03:51 +00:00
Add Lua functions:
+ getModName() + getModPath() And fileExists() returns the normalized file name as 2nd result now.
This commit is contained in:
parent
5410028906
commit
03f47b0480
1 changed files with 22 additions and 1 deletions
|
@ -876,7 +876,26 @@ luaFunc(fileExists)
|
||||||
safePath(L, s);
|
safePath(L, s);
|
||||||
std::string res;
|
std::string res;
|
||||||
bool there = findFile_helper(s.c_str(), 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},
|
{"loadfile", l_loadfile_caseinsensitive},
|
||||||
|
|
||||||
luaRegister(fileExists),
|
luaRegister(fileExists),
|
||||||
|
luaRegister(getModName),
|
||||||
|
luaRegister(getModPath),
|
||||||
|
|
||||||
luaRegister(debugBreak),
|
luaRegister(debugBreak),
|
||||||
luaRegister(setIgnoreAction),
|
luaRegister(setIgnoreAction),
|
||||||
|
|
Loading…
Add table
Reference in a new issue