/* ** Copies values from State src to State dst. */ static void copy_values (lua_State *dst, lua_State *src, int i, int top) { for (; i <= top; i++) { switch (lua_type (src, i)) { case LUA_TNUMBER: lua_pushnumber (dst, lua_tonumber (src, i)); break; case LUA_TBOOLEAN: lua_pushboolean (dst, lua_toboolean (src, i)); break; case LUA_TSTRING: { const char *string = lua_tostring (src, i); size_t length = lua_strlen (src, i); lua_pushlstring (dst, string, length); break; } case LUA_TUSERDATA: case LUA_TLIGHTUSERDATA: { lua_pushlightuserdata (dst, lua_touserdata (src, i)); break; } case LUA_TNIL: default: lua_pushnil (dst); break; } } }