cinvoke-svn
[Top][All Lists]
Advanced

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

[cinvoke-svn] r41 - trunk/cinvoke/bindings/lua


From: will
Subject: [cinvoke-svn] r41 - trunk/cinvoke/bindings/lua
Date: 24 Jun 2006 00:59:37 -0400

Author: will
Date: 2006-06-24 00:59:37 -0400 (Sat, 24 Jun 2006)
New Revision: 41

Modified:
   trunk/cinvoke/bindings/lua/cinvoke_lua.c
Log:
fixed chararray function


Modified: trunk/cinvoke/bindings/lua/cinvoke_lua.c
===================================================================
--- trunk/cinvoke/bindings/lua/cinvoke_lua.c    2006-06-24 03:45:19 UTC (rev 40)
+++ trunk/cinvoke/bindings/lua/cinvoke_lua.c    2006-06-24 04:59:37 UTC (rev 41)
@@ -508,7 +508,10 @@
                                        lua_pushinteger(l, i);
                                        lua_gettable(l, argindex);
 
-                                       if (lua_isnil(l, -1)) break;
+                                       if (lua_isnil(l, -1)) {
+                                               lua_pop(l, 1);
+                                               break;
+                                       }
 
                                        if (isstruct(l, typeindex))
                                                marshal_struct(l, tmp, 
typeindex, lua_gettop(l));
@@ -822,13 +825,18 @@
                        lua_pushstring(l, "out of memory");
                        lua_error(l);
                }
-               lua_pushnil(l);
-               while (lua_next(l, 1) != 0) {
-                       if (i >= len)  break;
+               for (i = 0; i < len; i++) {
+                       const char *s;
+                       lua_pushinteger(l, i + 1);
+                       lua_gettable(l, 1);
 
-                       ret[i] = (char)lua_tointeger(l, -1);
+                       if (lua_isnil(l, -1)) {
+                               lua_pop(l, 1);
+                               break;
+                       }
+                       ret[i] = lua_tostring(l, -1)[0];
+                       lua_pop(l, 1);
 
-                       lua_pop(l, 1);
                        i++;
                }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]