|
local function state(csobj, state) local csobj_mt = getmetatable(csobj) for k, v in pairs(csobj_mt) do rawset(state, k, v) end local csobj_index, csobj_newindex = state.__index, state.__newindex state.__index = function(obj, k) return rawget(state, k) or csobj_index(obj, k) end state.__newindex = function(obj, k, v) if rawget(state, k) ~= nil then rawset(state, k, v) else csobj_newindex(obj, k, v) end end debug.setmetatable(csobj, state) return stateendxlua.hotfix(CS.ClassName, '.ctor', function(self) CS.UnityEngine.Debug.LogError('.ctor'); return state(self, {newfield = '?'})end) |
|