/// <summary> /// Gets a copy of LuaTable that is protected against garbage collection. /// </summary> /// <param name="native">Table to protect.</param> /// <returns>A protected copy of the table.</returns> public LuaTable SafeProtectTableFromGC(LuaTable table) { lock (_luaState) { try { table = (LuaTable)table.CopyReference(); } catch (Exception ex) { table = HandleException <LuaTable>(ex, table); } } return(table); }