public void Clear() { CheckDisposed(); Runtime.Push(this); // Go over each key and remove it until the table is empty. for (;;) { LuaApi.lua_pushnil(Runtime.LuaState); if (LuaApi.lua_next(Runtime.LuaState, -2) == 0) { // Table is empty. LuaApi.lua_pop(Runtime.LuaState, 1); break; } // Replace the value with nil and set the key. LuaApi.lua_pop(Runtime.LuaState, 1); LuaApi.lua_pushnil(Runtime.LuaState); LuaApi.lua_settable(Runtime.LuaState, -3); // Next iteration will start from the next key by using a nil key again. } }
internal override void Push(LuaRuntime runtime) { LuaApi.lua_pushnil(runtime.LuaState); }