LuaInterface.ObjectTranslator.unregisterTable C# (CSharp) Method

unregisterTable() private method

private unregisterTable ( IntPtr luaState ) : int
luaState IntPtr
return int
        private int unregisterTable(IntPtr luaState)
        {
            try
            {
                if(LuaDLL.lua_getmetatable(luaState,1)!=0)
                {
                    LuaDLL.lua_pushstring(luaState,"__index");
                    LuaDLL.lua_gettable(luaState,-2);
                    object obj=getRawNetObject(luaState,-1);
                    if(obj==null) throwError(luaState,"unregister_table: arg is not valid table");
                    FieldInfo luaTableField=obj.GetType().GetField("__luaInterface_luaTable");
                    if(luaTableField==null) throwError(luaState,"unregister_table: arg is not valid table");
                    luaTableField.SetValue(obj,null);
                    LuaDLL.lua_pushnil(luaState);
                    LuaDLL.lua_setmetatable(luaState,1);
                    LuaDLL.lua_pushstring(luaState,"base");
                    LuaDLL.lua_pushnil(luaState);
                    LuaDLL.lua_settable(luaState,1);
                }
                else throwError(luaState,"unregister_table: arg is not valid table");
            }
            catch(Exception e)
            {
                throwError(luaState,e.Message);
            }
            return 0;
        }