[Scummvm-cvs-logs] scummvm master -> cbf7f740e4d61d3807308baf8af9adf8c6223ee6

dreammaster dreammaster at scummvm.org
Fri May 20 10:47:39 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
cbf7f740e4 SWORD25: Re-implement two LUA library I/O functions necessary for detecting and creating the config.lua configuration fi


Commit: cbf7f740e4d61d3807308baf8af9adf8c6223ee6
    https://github.com/scummvm/scummvm/commit/cbf7f740e4d61d3807308baf8af9adf8c6223ee6
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-05-20T01:45:33-07:00

Commit Message:
SWORD25: Re-implement two LUA library I/O functions necessary for detecting and creating the config.lua configuration file

Changed paths:
    engines/sword25/util/lua/lauxlib.cpp
    engines/sword25/util/lua/liolib.cpp



diff --git a/engines/sword25/util/lua/lauxlib.cpp b/engines/sword25/util/lua/lauxlib.cpp
index 526b1c8..ce61827 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 f9bad30..aea6c32 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;
+  }
 }
 
 






More information about the Scummvm-git-logs mailing list