xref and compat_api
This commit is contained in:
parent
41c5738129
commit
dd2d277106
|
@ -223,7 +223,7 @@ function list_str(self)
|
||||||
if type(vv) ~= 'string' then
|
if type(vv) ~= 'string' then
|
||||||
vv = stead.call(o, 'nam');
|
vv = stead.call(o, 'nam');
|
||||||
end
|
end
|
||||||
vv = xref(vv, o);
|
vv = stead.xref(vv, o);
|
||||||
v = stead.par(stead.delim, v, vv);
|
v = stead.par(stead.delim, v, vv);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -248,7 +248,7 @@ function obj_str(self)
|
||||||
if type(vv) ~= 'string' then
|
if type(vv) ~= 'string' then
|
||||||
vv = stead.call(o, 'nam');
|
vv = stead.call(o, 'nam');
|
||||||
end
|
end
|
||||||
vv = xref(vv, o);
|
vv = stead.xref(vv, o);
|
||||||
v = stead.par(stead.delim, v, vv, obj_str(o));
|
v = stead.par(stead.delim, v, vv, obj_str(o));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -388,7 +388,7 @@ end
|
||||||
function obj_xref(self,str)
|
function obj_xref(self,str)
|
||||||
function xrefrep(str)
|
function xrefrep(str)
|
||||||
local s = stead.string.gsub(str,'[\001\002]','');
|
local s = stead.string.gsub(str,'[\001\002]','');
|
||||||
return xref(s, self);
|
return stead.xref(s, self);
|
||||||
end
|
end
|
||||||
if not str then
|
if not str then
|
||||||
return
|
return
|
||||||
|
@ -478,7 +478,7 @@ function obj_str(self)
|
||||||
o = stead.ref(o);
|
o = stead.ref(o);
|
||||||
if o~= nil and not isDisabled(o) then -- isObject is better, but compat layer must be ok
|
if o~= nil and not isDisabled(o) then -- isObject is better, but compat layer must be ok
|
||||||
vv = stead.call(o, 'nam');
|
vv = stead.call(o, 'nam');
|
||||||
vv = xref(vv, o);
|
vv = stead.xref(vv, o);
|
||||||
v = stead.par(',', v, vv, obj_str(o));
|
v = stead.par(',', v, vv, obj_str(o));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -597,7 +597,7 @@ function list_str(self)
|
||||||
o = stead.ref(o);
|
o = stead.ref(o);
|
||||||
if o~= nil and not isDisabled(o) then
|
if o~= nil and not isDisabled(o) then
|
||||||
vv = stead.call(o, 'nam');
|
vv = stead.call(o, 'nam');
|
||||||
vv = xref(vv, o);
|
vv = stead.xref(vv, o);
|
||||||
v = stead.par(',', v, vv);
|
v = stead.par(',', v, vv);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1538,6 +1538,30 @@ function for_everything(f, ...)
|
||||||
for_each(_G, '_G', f, is_ok, ...)
|
for_each(_G, '_G', f, is_ok, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local compat_api = function()
|
||||||
|
if stead.api_version >= "1.4.5" or stead.compat_api then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
stead.xref = function(...)
|
||||||
|
return xref(...);
|
||||||
|
end
|
||||||
|
|
||||||
|
-- internals of call
|
||||||
|
cctx = stead.cctx
|
||||||
|
callpush = stead.callpush
|
||||||
|
callpop = stead.callpop
|
||||||
|
clearargs = stead.clearargs
|
||||||
|
|
||||||
|
-- savemembers = stead.savemembers;
|
||||||
|
-- savevar = stead.savevar
|
||||||
|
|
||||||
|
clearvar = stead.clearvar
|
||||||
|
do_ini = stead.do_ini
|
||||||
|
do_savegame = stead.do_savegame
|
||||||
|
|
||||||
|
stead.compat_api = true
|
||||||
|
end
|
||||||
|
|
||||||
stead.do_ini = function(self, load)
|
stead.do_ini = function(self, load)
|
||||||
local v='',vv
|
local v='',vv
|
||||||
local function call_key(k, o)
|
local function call_key(k, o)
|
||||||
|
@ -1556,12 +1580,14 @@ stead.do_ini = function(self, load)
|
||||||
game.where = stead.deref(game.where);
|
game.where = stead.deref(game.where);
|
||||||
|
|
||||||
if not load then
|
if not load then
|
||||||
|
compat_api()
|
||||||
for_each_object(call_key);
|
for_each_object(call_key);
|
||||||
for_each_codeblock(call_codekey);
|
for_each_codeblock(call_codekey);
|
||||||
for_each_object(stead.check_object);
|
for_each_object(stead.check_object);
|
||||||
call_key("game", game);
|
call_key("game", game);
|
||||||
for_each(game, "game", stead.check_list, isList, stead.deref(game))
|
for_each(game, "game", stead.check_list, isList, stead.deref(game))
|
||||||
end
|
end
|
||||||
|
|
||||||
for_each_object(call_ini, load);
|
for_each_object(call_ini, load);
|
||||||
me():tag();
|
me():tag();
|
||||||
if not self.showlast then
|
if not self.showlast then
|
||||||
|
@ -1570,7 +1596,6 @@ stead.do_ini = function(self, load)
|
||||||
stead.initialized = true
|
stead.initialized = true
|
||||||
return stead.par('',v, self._lastdisp); --stead.par('^^',v);
|
return stead.par('',v, self._lastdisp); --stead.par('^^',v);
|
||||||
end
|
end
|
||||||
do_ini = stead.do_ini
|
|
||||||
|
|
||||||
function game_ini(self)
|
function game_ini(self)
|
||||||
local v,vv
|
local v,vv
|
||||||
|
@ -1697,7 +1722,6 @@ stead.clearvar = function(v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
clearvar = stead.clearvar
|
|
||||||
|
|
||||||
stead.savemembers = function(h, self, name, need)
|
stead.savemembers = function(h, self, name, need)
|
||||||
local k,v
|
local k,v
|
||||||
|
@ -1858,7 +1882,6 @@ stead.do_savegame = function(s, h)
|
||||||
-- save_object('_G', _G, h);
|
-- save_object('_G', _G, h);
|
||||||
stead.clearvar(_G);
|
stead.clearvar(_G);
|
||||||
end
|
end
|
||||||
do_savegame = stead.do_savegame
|
|
||||||
|
|
||||||
function game_save(self, name, file)
|
function game_save(self, name, file)
|
||||||
local h;
|
local h;
|
||||||
|
@ -2208,11 +2231,13 @@ function ways(w)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function xref(str, obj, ...)
|
stead.xref = function(str, obj, ...)
|
||||||
if type(str) ~= 'string' then return nil; end;
|
if type(str) ~= 'string' then return nil; end;
|
||||||
return iface:xref(str, obj, ...);
|
return iface:xref(str, obj, ...);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
xref = stead.xref
|
||||||
|
|
||||||
function pseen(...)
|
function pseen(...)
|
||||||
if not isDialog(here()) then
|
if not isDialog(here()) then
|
||||||
return
|
return
|
||||||
|
|
|
@ -72,7 +72,7 @@ local __do_xact = function(str, self)
|
||||||
error("Wrong link: "..s, 3);
|
error("Wrong link: "..s, 3);
|
||||||
end
|
end
|
||||||
d = d:gsub("\001", delim);
|
d = d:gsub("\001", delim);
|
||||||
return xref(d, stead.ref(oo, true), unpack(aarg));
|
return stead.xref(d, stead.ref(oo, true), unpack(aarg));
|
||||||
end
|
end
|
||||||
if type(str) ~= 'string' then return end
|
if type(str) ~= 'string' then return end
|
||||||
local s = stead.string.gsub(str, '\\?[\\{}]',
|
local s = stead.string.gsub(str, '\\?[\\{}]',
|
||||||
|
|
Loading…
Reference in a new issue