All pastes #941482 Raw Edit

Stuff

public text v1 · immutable
·published 2008-03-13 18:51 UTC
rendered paste body
   /* data we save */
   lua_newtable(L);
   lua_rawget(L,LUA_GLOBALSINDEX);
   lua_pushnil(L);

   while (lua_next(L,-2) != 0) {
      /* table, global table, key, value */
      switch (lua_type(L, -1)) {
         case LUA_TNUMBER:
         case LUA_TBOOLEAN:
         case LUA_TSTRING:
            lua_pushnumber(L,i++);
            /* table, global table, key, value, value2 */
            lua_settable(L,-5);
            /* table, global table, key */
         
         default:
            continue;
      }
   }