From 68db5dff42402f7c6fada1beb8fa16402273a237 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 15 Oct 2006 04:59:48 +0000 Subject: [PATCH] proper error messages, and return nil on error --- stepmania/src/ActorUtil.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index c589b3beaf..94ba6261ea 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -636,11 +636,18 @@ namespace int ResolvePath( lua_State *L ) { RString sPath( SArg(1) ); + int iLevel = IArg(2); + 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(); - ActorUtil::ResolvePath( sPath, "" ); + bool bRet = ActorUtil::ResolvePath( sPath, sWhere ); LUA->UnyieldLua(); + if( !bRet ) + return 0; LuaHelpers::Push( L, sPath ); return 1; }