Skip to content

Commit

Permalink
除hotfix场景下,其它场景也可以用,所以hotfix_state重命名为state
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed May 7, 2018
1 parent beac526 commit 3824ab5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Assets/XLua/Doc/hotfix.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ luaenv.DoString(@"

xlua.hotfix(CS.StatefullTest, {
['.ctor'] = function(csobj)
return util.hotfix_state(csobj, {evt = {}, start = 0, prop = 0})
return util.state(csobj, {evt = {}, start = 0, prop = 0})
end;
set_AProp = function(self, v)
print('set_AProp', v)
Expand Down
2 changes: 1 addition & 1 deletion Assets/XLua/Examples/08_Hotfix/HotfixTest2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ void Start () {
local util = require 'xlua.util'
xlua.hotfix(CS.StatefullTest, {
['.ctor'] = function(csobj)
util.hotfix_state(csobj, {evt = {}, start = 0, prop = 0})
util.state(csobj, {evt = {}, start = 0, prop = 0})
end;
set_AProp = function(self, v)
print('set_AProp', v)
Expand Down
4 changes: 2 additions & 2 deletions Assets/XLua/Resources/xlua/util.lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ local function createdelegate(delegate_cls, obj, impl_cls, method_name, paramete
return CS.System.Delegate.CreateDelegate(typeof(delegate_cls), obj, m)
end

local function hotfix_state(csobj, state)
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
Expand All @@ -161,5 +161,5 @@ return {
hotfix_ex = hotfix_ex,
bind = bind,
createdelegate = createdelegate,
hotfix_state = hotfix_state,
state = state,
}
2 changes: 1 addition & 1 deletion Assets/XLua/Src/GenAttributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public class AdditionalPropertiesAttribute : Attribute
public enum HotfixFlag
{
Stateless = 0,
[Obsolete("use xlua.util.hotfix_state instead!", true)]
[Obsolete("use xlua.util.state instead!", true)]
Stateful = 1,
ValueTypeBoxing = 2,
IgnoreProperty = 4,
Expand Down

0 comments on commit 3824ab5

Please sign in to comment.