diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-08-18 12:29:54 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2017-08-18 12:29:54 +0200 |
commit | b8dda388e0cf300f573d411dc670099e56c2e3c3 (patch) | |
tree | 6c3f40beb7a652f9c5afa560954e68a53db54401 /src/Bindings/DeprecatedBindings.cpp | |
parent | Changed type of FastRandom in monster drop calculation. (#3920) (diff) | |
download | cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.gz cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.bz2 cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.lz cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.xz cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.tar.zst cuberite-b8dda388e0cf300f573d411dc670099e56c2e3c3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/DeprecatedBindings.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/Bindings/DeprecatedBindings.cpp b/src/Bindings/DeprecatedBindings.cpp index e75250604..3ae1fd990 100644 --- a/src/Bindings/DeprecatedBindings.cpp +++ b/src/Bindings/DeprecatedBindings.cpp @@ -347,6 +347,58 @@ static int tolua_set_cBlockInfo_m_PlaceSound(lua_State * tolua_S) +static int tolua_get_cItem_m_Lore(lua_State * tolua_S) +{ + // Maintain legacy m_Lore variable as Lore table split by ` (grave-accent) + cLuaState L(tolua_S); + if (!L.CheckParamSelf("const cItem")) + { + return 0; + } + + const cItem * Self = nullptr; + L.GetStackValue(1, Self); + + AString LoreString = StringJoin(Self->m_LoreTable, "`"); + + L.Push(LoreString); + + LOGWARNING("cItem.m_Lore is deprecated, use cItem.m_LoreTable instead"); + L.LogStackTrace(0); + return 1; +} + + + + + +static int tolua_set_cItem_m_Lore(lua_State * tolua_S) +{ + // Maintain legacy m_Lore variable as Lore table split by ` (grave-accent) + cLuaState L(tolua_S); + if ( + !L.CheckParamSelf("cItem") || + !L.CheckParamString(2) + ) + { + return 0; + } + + cItem * Self = nullptr; + AString LoreString; + L.GetStackValues(1, Self, LoreString); + + Self->m_LoreTable = StringSplit(LoreString, "`"); + + LOGWARNING("cItem.m_Lore is deprecated, use cItem.m_LoreTable instead"); + L.LogStackTrace(0); + return 0; +} + + + + + /* method: Trace of class cTracer */ static int tolua_cTracer_Trace(lua_State * a_LuaState) { @@ -500,6 +552,10 @@ void DeprecatedBindings::Bind(lua_State * tolua_S) tolua_variable(tolua_S, "m_PlaceSound", tolua_get_cBlockInfo_m_PlaceSound, tolua_set_cBlockInfo_m_PlaceSound); tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cItem"); + tolua_variable(tolua_S, "m_Lore", tolua_get_cItem_m_Lore, tolua_set_cItem_m_Lore); + tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cTracer"); tolua_function(tolua_S, "Trace", tolua_cTracer_Trace); tolua_endmodule(tolua_S); |