Keep it clean.
authoronefang <onefang>
Sat, 19 Nov 2011 01:38:54 +0000 (01:38 +0000)
committeronefang <onefang@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Sat, 19 Nov 2011 01:38:54 +0000 (01:38 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/edje@65397 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/edje_lua2.c

index a7ab626..e3f13a3 100644 (file)
@@ -377,7 +377,7 @@ _elua_push_name(lua_State *L, char *q, int index)  // Stack usage [-0, +1, e or
 static int
 _elua_scan_params(lua_State *L, int i, Eina_Bool tr, char *params, ...)  // Stack usage -
                                                                          // if i is a table  
-                                                                         //   [-0, +n, e]
+                                                                         //   [-n, +n, e]
                                                                          // else
                                                                          //   [-0, +0, -]
                                                                          // if tr
@@ -423,7 +423,6 @@ _elua_scan_params(lua_State *L, int i, Eina_Bool tr, char *params, ...)  // Stac
                        *v = lua_tointeger(L, j);                         // Stack usage [-0, +0, -]
                        n++;
                     }
-// FIXME: Should probably pop that name off the stack if it's a table.  Same for the following.
                   break;
                }
              case '#':
@@ -487,6 +486,9 @@ _elua_scan_params(lua_State *L, int i, Eina_Bool tr, char *params, ...)  // Stac
           {
              if (table)
                {
+                  // If this is a table, then we pushed a value on the stack, pop it off.  But only if not tr, coz otherwise the stack gets reset anyway.
+                  if (!tr)
+                     lua_pop(L, 1);                                      // Stack usage [-n, +0, -]
                }
             else
                 j++;