diff options
Diffstat (limited to 'lib/liblua_wrapper.cc')
| -rw-r--r-- | lib/liblua_wrapper.cc | 24 | 
1 files changed, 12 insertions, 12 deletions
| diff --git a/lib/liblua_wrapper.cc b/lib/liblua_wrapper.cc index 6535f4e..9e06be9 100644 --- a/lib/liblua_wrapper.cc +++ b/lib/liblua_wrapper.cc @@ -51,10 +51,10 @@ int LibLUAWrapper::loadFile(char *fname)    case LUA_ERRSYNTAX: //syntax error during pre-compilation;    case LUA_ERRMEM: //memory allocation error.    case LUA_ERRFILE: //cannot open/read the file. -    error = std::string(lua_tostring(L, lua_gettop(L))); +    strerr = std::string(lua_tostring(L, lua_gettop(L)));      return 1;    default: -    error = std::string("Unknown return value of luaL_loadfile."); +    strerr = std::string("Unknown return value of luaL_loadfile.");      return 1;    } @@ -66,10 +66,10 @@ int LibLUAWrapper::loadFile(char *fname)    case LUA_ERRRUN:// a runtime error.    case LUA_ERRMEM:// memory allocation error. For such errors, Lua does not call the error handler function.    case LUA_ERRERR:// error while running the error handler function. -    error = std::string(lua_tostring(L, lua_gettop(L))); +    strerr = std::string(lua_tostring(L, lua_gettop(L)));      return 1;    default: -    error = std::string("Unknown return value of lua_pcall."); +    strerr = std::string("Unknown return value of lua_pcall.");      return 1;    } @@ -87,10 +87,10 @@ int LibLUAWrapper::loadBuffer(char *buffer)      break;    case LUA_ERRSYNTAX: //syntax error during pre-compilation;    case LUA_ERRMEM: //memory allocation error. -    error = std::string(lua_tostring(L, lua_gettop(L))); +    strerr = std::string(lua_tostring(L, lua_gettop(L)));      return 1;    default: -    error = std::string("Unknown return value of luaL_loadstring."); +    strerr = std::string("Unknown return value of luaL_loadstring.");      return 1;    } @@ -102,10 +102,10 @@ int LibLUAWrapper::loadBuffer(char *buffer)    case LUA_ERRRUN:// a runtime error.    case LUA_ERRMEM:// memory allocation error. For such errors, Lua does not call the error handler function.    case LUA_ERRERR:// error while running the error handler function. -    error = std::string(lua_tostring(L, lua_gettop(L))); +    strerr = std::string(lua_tostring(L, lua_gettop(L)));      return 1;    default: -    error = std::string("Unknown return value of lua_pcall."); +    strerr = std::string("Unknown return value of lua_pcall.");      return 1;    } @@ -164,9 +164,9 @@ std::string LibLUAWrapper::getString(char *name)    return val;  } -std::string LibLUAWrapper::getError() +std::string LibLUAWrapper::error()  { -  return error; +  return strerr;  }  #ifdef LUA_TEST @@ -184,12 +184,12 @@ int main()    LibLUAWrapper lua;    if(lua.loadBuffer((char*)preload)) { -    fprintf(stderr, "LUA buffer error: %s\n", lua.getError().c_str()); +    fprintf(stderr, "LUA buffer error: %s\n", lua.error().c_str());      return 1;    }    if(lua.loadFile("test.lua")) { -    fprintf(stderr, "LUA load error: %s\n", lua.getError().c_str()); +    fprintf(stderr, "LUA load error: %s\n", lua.error().c_str());      return 1;    } | 
