lua-users home
lua-l archive

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


On 05/11/2012 15:39, Roberto Ierusalimschy wrote:
struct library [1] fails to complete its test if Lua 5.1.5 was
compiled with -DLUA_USE_APICHECK. The patch below fixes it.
 [...]

Many thanks for the feedback!


The more elegant fix would be:

--- struct.c	Wed Jul 04 20:54:36 2012
+++ work\struct.c	Mon Nov 05 16:08:22 2012
@@ -301,7 +301,7 @@
     size_t size = optsize(L, opt, &fmt);
     pos += gettoalign(pos, &h, opt, size);
     luaL_argcheck(L, pos+size <= ld, 2, "data string too short");
-    luaL_checkstack(L, 1, "too many results");
+    luaL_checkstack(L, 2, "too many results");
     switch (opt) {
       case 'b': case 'B': case 'h': case 'H':
case 'l': case 'L': case 'T': case 'i': case 'I': { /* integer types */

--
Shmuel