Expose the optional argument for ResolvePath to lua and add it to ResolveRelativePath.
This commit is contained in:
@@ -472,8 +472,8 @@ save yourself some time, copy this for undocumented things:
|
||||
"Sets the real value of <code>t[index]</code> to <code>value</code>, without invoking any metamethod."
|
||||
The modified <code>t</code> is then returned.
|
||||
</Function>
|
||||
<Function name='ResolveRelativePath' theme='_fallback' return='string' arguments='string path, int level'>
|
||||
[02 ActorDef.lua]
|
||||
<Function name='ResolveRelativePath' theme='_fallback' return='string' arguments='string path, int level, bool optional'>
|
||||
[02 ActorDef.lua] Used internally by LoadActor to resolve a path. If <code>optional</code> is true, then a nil path is returned instead of emitting an error if no file is found.
|
||||
</Function>
|
||||
<Function name='ReadFile' theme='_fallback' return='string' arguments='string path'>
|
||||
[04 FileUtils.lua] Reads the file at <code>path</code> and returns its contents.
|
||||
@@ -700,7 +700,9 @@ save yourself some time, copy this for undocumented things:
|
||||
<Function name='LoadAllCommandsAndSetXY' return='void' arguments='Actor a'>
|
||||
Loads all commands and sets X and Y for the specified Actor.
|
||||
</Function>
|
||||
<Function name='ResolvePath' return='string' arguments='string sPath, int iLevel' />
|
||||
<Function name='ResolvePath' return='string' arguments='string sPath, int iLevel, bool optional'>
|
||||
Used internally by LoadActor to resolve a path. If <code>optional</code> is true, then a nil path is returned instead of emitting an error if no file is found.
|
||||
</Function>
|
||||
</Namespace>
|
||||
<Namespace name='ArrowEffects'>
|
||||
<Function name='Update' return='void' arguments=''>
|
||||
|
||||
@@ -79,7 +79,7 @@ setmetatable( Def, {
|
||||
end,
|
||||
})
|
||||
|
||||
function ResolveRelativePath( path, level )
|
||||
function ResolveRelativePath(path, level, optional)
|
||||
if path:sub(1,1) ~= "/" then
|
||||
-- "Working directory":
|
||||
local sDir = DebugPathToRealPath( debug.getinfo(level+1,"S").source )
|
||||
@@ -88,7 +88,7 @@ function ResolveRelativePath( path, level )
|
||||
path = sDir .. path
|
||||
end
|
||||
|
||||
path = ActorUtil.ResolvePath( path, level+1 )
|
||||
path = ActorUtil.ResolvePath(path, level+1, optional)
|
||||
return path
|
||||
end
|
||||
|
||||
|
||||
+2
-1
@@ -623,13 +623,14 @@ namespace
|
||||
{
|
||||
RString sPath( SArg(1) );
|
||||
int iLevel = IArg(2);
|
||||
bool optional= lua_toboolean(L, 3);
|
||||
luaL_where( L, iLevel );
|
||||
RString sWhere = lua_tostring( L, -1 );
|
||||
if( sWhere.size() > 2 && sWhere.substr(sWhere.size()-2, 2) == ": " )
|
||||
sWhere = sWhere.substr( 0, sWhere.size()-2 ); // remove trailing ": "
|
||||
|
||||
LUA->YieldLua();
|
||||
bool bRet = ActorUtil::ResolvePath( sPath, sWhere );
|
||||
bool bRet = ActorUtil::ResolvePath(sPath, sWhere, optional);
|
||||
LUA->UnyieldLua();
|
||||
|
||||
if( !bRet )
|
||||
|
||||
Reference in New Issue
Block a user