/// <summary> /// Creates a table with tableName if it does not already exist. /// After creation or if the table already exists, stack will be empty and balanced. /// </summary> /// <param name="tableName"></param> public void CreateLuaTable(string tableName) { Lua.lua_getglobal(L, tableName); if (IsTopNil) { //remove the nil value Lua.lua_pop(L, 1); Lua.lua_newtable(L); Lua.lua_setglobal(L, tableName); //stack is empty } else { //remove the existing table from the stack Lua.lua_pop(L, 1); } }