lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2007/3/25, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
Lua 5.1.2-rc2 is now available at
        http://www.lua.org/work/lua-5.1.2-rc2.tar.gz

In some personnal project I build lua core and lualib seperately, and
there is a single limitation in loadlib.c that prevent me from doing
this. On some lines the function luaO_pushfstring is called, which is
not exposed by core API. The following patch fixes that with replacing
these calls with calls to lua_pushfstring. So far I haven't had any
problem with it, so if you think it won't hurt it could be useful for
some people. Here is the patch :

--- loadlib.c.orig	Mon Apr 10 14:27:24 2006
+++ loadlib.c	Sun Mar 25 13:57:15 2007
@@ -363,7 +363,7 @@
    if (readable(filename))  /* does file exist and is readable? */
      return filename;  /* return that file name */
    lua_pop(L, 2);  /* remove path template and file name */
-    luaO_pushfstring(L, "\n\tno file " LUA_QS, filename);
+    lua_pushfstring(L, "\n\tno file " LUA_QS, filename);
    lua_concat(L, 2);
  }
  return NULL;  /* not found */
@@ -423,7 +423,7 @@
  funcname = mkfuncname(L, name);
  if ((stat = ll_loadfunc(L, filename, funcname)) != 0) {
    if (stat != ERRFUNC) loaderror(L, filename);  /* real error */
-    luaO_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
+    lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS,
                        name, filename);
    return 1;  /* function not found */
  }
@@ -438,7 +438,7 @@
    luaL_error(L, LUA_QL("package.preload") " must be a table");
  lua_getfield(L, -1, name);
  if (lua_isnil(L, -1))  /* not found? */
-    luaO_pushfstring(L, "\n\tno field package.preload['%s']", name);
+    lua_pushfstring(L, "\n\tno field package.preload['%s']", name);
  return 1;
}