diff options
author | Paul Gilbert | 2011-05-20 18:45:33 +1000 |
---|---|---|
committer | Paul Gilbert | 2011-05-20 18:45:33 +1000 |
commit | cbf7f740e4d61d3807308baf8af9adf8c6223ee6 (patch) | |
tree | b670de1d35d9ca04a78df522ef485d2b29d5965a /engines | |
parent | 5fdf2796d6542db5ae05774bbbe792923c67b68b (diff) | |
download | scummvm-rg350-cbf7f740e4d61d3807308baf8af9adf8c6223ee6.tar.gz scummvm-rg350-cbf7f740e4d61d3807308baf8af9adf8c6223ee6.tar.bz2 scummvm-rg350-cbf7f740e4d61d3807308baf8af9adf8c6223ee6.zip |
SWORD25: Re-implement two LUA library I/O functions necessary for detecting and creating the config.lua configuration file
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sword25/util/lua/lauxlib.cpp | 6 | ||||
-rw-r--r-- | engines/sword25/util/lua/liolib.cpp | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/engines/sword25/util/lua/lauxlib.cpp b/engines/sword25/util/lua/lauxlib.cpp index 526b1c84ab..ce61827e0f 100644 --- a/engines/sword25/util/lua/lauxlib.cpp +++ b/engines/sword25/util/lua/lauxlib.cpp @@ -540,7 +540,11 @@ static const char *getF (lua_State *L, void *ud, size_t *size) { static int errfile (lua_State *L, const char *what, int fnameindex) { - return luaL_error(L, "LUA function errfile has been removed in ScummVM"); + const char *serr = "General error"; + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; } diff --git a/engines/sword25/util/lua/liolib.cpp b/engines/sword25/util/lua/liolib.cpp index f9bad30aed..aea6c328d8 100644 --- a/engines/sword25/util/lua/liolib.cpp +++ b/engines/sword25/util/lua/liolib.cpp @@ -27,7 +27,20 @@ static const char *const fnames[] = {"input", "output"}; static int pushresult (lua_State *L, int i, const char *filename) { - return luaL_error(L, "LUA file I/O functions have been removed in ScummVM"); + int en = 0; /*errno;*/ // Currently hardcoded for ScumMVM, this may need to be changed + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, "General error" /*strerror(en)*/); + else + lua_pushfstring(L, "%s", "General error" /*strerror(en)*/); + lua_pushinteger(L, en); + return 3; + } } |