ref and deref moved to stead
This commit is contained in:
parent
00a750ce46
commit
91824aaa66
|
@ -88,7 +88,7 @@ function disp_obj()
|
||||||
end
|
end
|
||||||
|
|
||||||
dump_obj = function(w)
|
dump_obj = function(w)
|
||||||
w = ref(w)
|
w = stead.ref(w)
|
||||||
if type(w) ~= 'table' then
|
if type(w) ~= 'table' then
|
||||||
seen('disp')._txt = '^^No such object.';
|
seen('disp')._txt = '^^No such object.';
|
||||||
return true
|
return true
|
||||||
|
@ -103,8 +103,8 @@ dump_obj = function(w)
|
||||||
if t then
|
if t then
|
||||||
if rc ~='' then rc = rc..'^' end
|
if rc ~='' then rc = rc..'^' end
|
||||||
local n = '';
|
local n = '';
|
||||||
if type(o) ~= 'function' and isObject(ref(o)) then
|
if type(o) ~= 'function' and isObject(stead.ref(o)) then
|
||||||
n = stead.call(ref(o), 'nam');
|
n = stead.call(stead.ref(o), 'nam');
|
||||||
if type(n) ~= 'string' then n = '' else n = ' : '..n; end
|
if type(n) ~= 'string' then n = '' else n = ' : '..n; end
|
||||||
end
|
end
|
||||||
rc = stead.cat(rc, stead.par(' ', tostring(i)..' : '..t..n));
|
rc = stead.cat(rc, stead.par(' ', tostring(i)..' : '..t..n));
|
||||||
|
@ -138,13 +138,13 @@ end
|
||||||
|
|
||||||
list_objects = function()
|
list_objects = function()
|
||||||
local i,o
|
local i,o
|
||||||
local rc = stead.par(' ', 'Room:'..tostring(deref(dbg_here())),
|
local rc = stead.par(' ', 'Room:'..tostring(stead.deref(dbg_here())),
|
||||||
'Nam:'..tostring(stead.call(dbg_here(),'nam')));
|
'Nam:'..tostring(stead.call(dbg_here(),'nam')));
|
||||||
for i,o in opairs(objs(dbg_here())) do
|
for i,o in opairs(objs(dbg_here())) do
|
||||||
rc = rc..'^';
|
rc = rc..'^';
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
rc = stead.cat(rc, stead.par(' ', 'Id:'..tostring(o.id),
|
rc = stead.cat(rc, stead.par(' ', 'Id:'..tostring(o.id),
|
||||||
'Obj:'..tostring(deref(o)),
|
'Obj:'..tostring(stead.deref(o)),
|
||||||
'Nam:'..tostring(stead.call(o, 'nam')),
|
'Nam:'..tostring(stead.call(o, 'nam')),
|
||||||
'Disabled:'..tostring(isDisabled(o))));
|
'Disabled:'..tostring(isDisabled(o))));
|
||||||
end
|
end
|
||||||
|
@ -157,8 +157,8 @@ list_inv = function()
|
||||||
local rc=''
|
local rc=''
|
||||||
for i,o in opairs(inv()) do
|
for i,o in opairs(inv()) do
|
||||||
if rc ~='' then rc = rc..'^' end
|
if rc ~='' then rc = rc..'^' end
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
rc = stead.cat(rc, stead.par(' ', 'Id:'..tostring(o.id), 'Obj:'..tostring(deref(o)),
|
rc = stead.cat(rc, stead.par(' ', 'Id:'..tostring(o.id), 'Obj:'..tostring(stead.deref(o)),
|
||||||
'Nam:'..tostring(stead.call(o, 'nam')),
|
'Nam:'..tostring(stead.call(o, 'nam')),
|
||||||
'Disabled:'..tostring(isDisabled(o)),
|
'Disabled:'..tostring(isDisabled(o)),
|
||||||
'Taken:'..tostring(taken(o))));
|
'Taken:'..tostring(taken(o))));
|
||||||
|
@ -201,7 +201,7 @@ dump_object = room {
|
||||||
inp_enter = function(s)
|
inp_enter = function(s)
|
||||||
local w = s.obj[1]._txt
|
local w = s.obj[1]._txt
|
||||||
if type(w) == 'string' then
|
if type(w) == 'string' then
|
||||||
if not ref(w) then w = objs(dbg_here()):srch(w); end
|
if not stead.ref(w) then w = objs(dbg_here()):srch(w); end
|
||||||
return dump_obj(w);
|
return dump_obj(w);
|
||||||
end
|
end
|
||||||
return back();
|
return back();
|
||||||
|
@ -274,14 +274,14 @@ drop_object = dlg {
|
||||||
local k,v
|
local k,v
|
||||||
objs(s):zap();
|
objs(s):zap();
|
||||||
for k,v in ipairs(inv()) do
|
for k,v in ipairs(inv()) do
|
||||||
v = ref(v);
|
v = stead.ref(v);
|
||||||
if not v.debug then
|
if not v.debug then
|
||||||
local n = tostring(stead.call(v, 'nam'));
|
local n = tostring(stead.call(v, 'nam'));
|
||||||
local o = deref(v);
|
local o = stead.deref(v);
|
||||||
if type(o) == 'string' then
|
if type(o) == 'string' then
|
||||||
n = n..' : '..o;
|
n = n..' : '..o;
|
||||||
n = _xref_escape(n);
|
n = _xref_escape(n);
|
||||||
put (phr(n, true, o..':enable(); drop('..o..','..deref(dbg_here())..')'), s)
|
put (phr(n, true, o..':enable(); drop('..o..','..stead.deref(dbg_here())..')'), s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,11 +15,11 @@ go = function (self, where, back, noenter, noexit, nodsc)
|
||||||
return nil, ret(false)
|
return nil, ret(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not isRoom(ref(where)) then
|
if not isRoom(stead.ref(where)) then
|
||||||
error ("Trying to go nowhere: "..where);
|
error ("Trying to go nowhere: "..where);
|
||||||
end
|
end
|
||||||
|
|
||||||
if not isRoom(ref(self.where)) then
|
if not isRoom(stead.ref(self.where)) then
|
||||||
error ("Trying to go from nowhere: "..self.where);
|
error ("Trying to go from nowhere: "..self.where);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -29,15 +29,15 @@ go = function (self, where, back, noenter, noexit, nodsc)
|
||||||
|
|
||||||
local v, r, jump;
|
local v, r, jump;
|
||||||
|
|
||||||
if not isVroom(ref(where)) and not stead.in_exit_call and not noexit then
|
if not isVroom(stead.ref(where)) and not stead.in_exit_call and not noexit then
|
||||||
stead.in_exit_call = true -- to break recurse
|
stead.in_exit_call = true -- to break recurse
|
||||||
v,r = stead.call(ref(self.where), 'exit', ref(where));
|
v,r = stead.call(stead.ref(self.where), 'exit', stead.ref(where));
|
||||||
stead.in_exit_call = nil
|
stead.in_exit_call = nil
|
||||||
if r == false or (stead.api_version >= "1.3.0" and v == false and r == nil) then
|
if r == false or (stead.api_version >= "1.3.0" and v == false and r == nil) then
|
||||||
return v, ret(r)
|
return v, ret(r)
|
||||||
end
|
end
|
||||||
if self.where ~= was then
|
if self.where ~= was then
|
||||||
where = deref(self.where) -- jump
|
where = stead.deref(self.where) -- jump
|
||||||
jump = true
|
jump = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -45,12 +45,12 @@ go = function (self, where, back, noenter, noexit, nodsc)
|
||||||
local res = v;
|
local res = v;
|
||||||
v = nil;
|
v = nil;
|
||||||
|
|
||||||
if not isVroom(ref(where)) then
|
if not isVroom(stead.ref(where)) then
|
||||||
self.where = deref(where);
|
self.where = stead.deref(where);
|
||||||
end
|
end
|
||||||
|
|
||||||
if not jump and not noenter then
|
if not jump and not noenter then
|
||||||
v, r = stead.call(ref(where), 'enter', ref(was));
|
v, r = stead.call(stead.ref(where), 'enter', stead.ref(was));
|
||||||
if r == false or (stead.api_version >= "1.3.0" and v == false and r == nil) then
|
if r == false or (stead.api_version >= "1.3.0" and v == false and r == nil) then
|
||||||
self.where = was;
|
self.where = was;
|
||||||
return par('^^', res, v), ret(r)
|
return par('^^', res, v), ret(r)
|
||||||
|
@ -58,14 +58,14 @@ go = function (self, where, back, noenter, noexit, nodsc)
|
||||||
end
|
end
|
||||||
|
|
||||||
need_scene = true;
|
need_scene = true;
|
||||||
if ref(where) ~= ref(self.where) then -- jump !!!
|
if stead.ref(where) ~= stead.ref(self.where) then -- jump !!!
|
||||||
need_scene = false;
|
need_scene = false;
|
||||||
end
|
end
|
||||||
|
|
||||||
res = par('^^',res,v);
|
res = par('^^',res,v);
|
||||||
|
|
||||||
if not back then
|
if not back then
|
||||||
ref(where).__from__ = deref(was);
|
stead.ref(where).__from__ = stead.deref(was);
|
||||||
end
|
end
|
||||||
|
|
||||||
ret()
|
ret()
|
||||||
|
@ -80,28 +80,28 @@ go = function (self, where, back, noenter, noexit, nodsc)
|
||||||
if not noexit then
|
if not noexit then
|
||||||
self.where = was
|
self.where = was
|
||||||
stead.in_onexit_call = true
|
stead.in_onexit_call = true
|
||||||
v = stead.call(ref(was), 'left', ref(to));
|
v = stead.call(stead.ref(was), 'left', stead.ref(to));
|
||||||
stead.in_onexit_call = false
|
stead.in_onexit_call = false
|
||||||
res = par('^^',res,v);
|
res = par('^^',res,v);
|
||||||
end
|
end
|
||||||
|
|
||||||
self.where = deref(to)
|
self.where = stead.deref(to)
|
||||||
|
|
||||||
if not noenter then
|
if not noenter then
|
||||||
stead.in_entered_call = true
|
stead.in_entered_call = true
|
||||||
v = stead.call(ref(to), 'entered', ref(was));
|
v = stead.call(stead.ref(to), 'entered', stead.ref(was));
|
||||||
stead.in_entered_call = false
|
stead.in_entered_call = false
|
||||||
res = par('^^',res,v);
|
res = par('^^',res,v);
|
||||||
end
|
end
|
||||||
|
|
||||||
if tonumber(ref(to).__visited) then
|
if tonumber(stead.ref(to).__visited) then
|
||||||
ref(to).__visited = ref(to).__visited + 1;
|
stead.ref(to).__visited = stead.ref(to).__visited + 1;
|
||||||
elseif here().__visited == nil then
|
elseif here().__visited == nil then
|
||||||
ref(to).__visited = 1
|
stead.ref(to).__visited = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if isDialog(ref(to)) then
|
if isDialog(stead.ref(to)) then
|
||||||
dialog_rescan(ref(to));
|
dialog_rescan(stead.ref(to));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return res;
|
return res;
|
||||||
|
@ -109,7 +109,7 @@ end
|
||||||
stead.go = go
|
stead.go = go
|
||||||
|
|
||||||
function player_go(self, where) -- cmd iface
|
function player_go(self, where) -- cmd iface
|
||||||
local w = ref(self.where).way:srch(where);
|
local w = stead.ref(self.where).way:srch(where);
|
||||||
if not w then
|
if not w then
|
||||||
return nil,false
|
return nil,false
|
||||||
end
|
end
|
||||||
|
@ -149,7 +149,7 @@ end
|
||||||
stead.goin = goin
|
stead.goin = goin
|
||||||
|
|
||||||
function goout(what)
|
function goout(what)
|
||||||
if isRoom(ref(what)) then
|
if isRoom(stead.ref(what)) then
|
||||||
return me():goto(what, true, true, false, true);
|
return me():goto(what, true, true, false, true);
|
||||||
end
|
end
|
||||||
return me():goto(from(), true, true, false, true);
|
return me():goto(from(), true, true, false, true);
|
||||||
|
@ -158,7 +158,7 @@ stead.goout = goout
|
||||||
|
|
||||||
function visited(w)
|
function visited(w)
|
||||||
if not w then w = here() end
|
if not w then w = here() end
|
||||||
w = ref(w)
|
w = stead.ref(w)
|
||||||
if w == nil then
|
if w == nil then
|
||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,14 +9,14 @@ game.gui = {
|
||||||
}
|
}
|
||||||
|
|
||||||
iface.xref = function(self, str, obj, ...)
|
iface.xref = function(self, str, obj, ...)
|
||||||
local o = ref(obj);
|
local o = stead.ref(obj);
|
||||||
local cmd=''
|
local cmd=''
|
||||||
|
|
||||||
if not isObject(o) or isStatus(o) or (not o.id and not isXaction(o)) then
|
if not isObject(o) or isStatus(o) or (not o.id and not isXaction(o)) then
|
||||||
return str;
|
return str;
|
||||||
end
|
end
|
||||||
|
|
||||||
if ref(ways():srch(obj)) then
|
if stead.ref(ways():srch(obj)) then
|
||||||
cmd = 'go ';
|
cmd = 'go ';
|
||||||
elseif isMenu(o) then
|
elseif isMenu(o) then
|
||||||
cmd = 'act ';
|
cmd = 'act ';
|
||||||
|
@ -32,7 +32,7 @@ iface.xref = function(self, str, obj, ...)
|
||||||
a = a..','..varg[i]
|
a = a..','..varg[i]
|
||||||
end
|
end
|
||||||
if isXaction(o) and not o.id then
|
if isXaction(o) and not o.id then
|
||||||
return stead.cat('<a:'..cmd..deref(obj)..a..'>',str,'</a>');
|
return stead.cat('<a:'..cmd..stead.deref(obj)..a..'>',str,'</a>');
|
||||||
end
|
end
|
||||||
return stead.cat('<a:'..cmd..'0'..tostring(o.id)..a..'>',str,'</a>');
|
return stead.cat('<a:'..cmd..'0'..tostring(o.id)..a..'>',str,'</a>');
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -206,7 +206,7 @@ end)
|
||||||
lookup_inp = function()
|
lookup_inp = function()
|
||||||
local i,o
|
local i,o
|
||||||
for i,o in opairs(objs()) do
|
for i,o in opairs(objs()) do
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
if o._edit then
|
if o._edit then
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@ function player_action(self, what, ...)
|
||||||
local v,r,obj
|
local v,r,obj
|
||||||
obj = _G[what];
|
obj = _G[what];
|
||||||
if not isXaction(obj) then
|
if not isXaction(obj) then
|
||||||
obj = ref(self.where):srch(what);
|
obj = stead.ref(self.where):srch(what);
|
||||||
end
|
end
|
||||||
if not obj then
|
if not obj then
|
||||||
return stead.call(game, 'action', what, ...); --player_do(self, what, ...);
|
return stead.call(game, 'action', what, ...); --player_do(self, what, ...);
|
||||||
|
@ -24,7 +24,7 @@ function player_use(self, what, onwhat, ...)
|
||||||
|
|
||||||
obj = self:srch(what); -- in inv?
|
obj = self:srch(what); -- in inv?
|
||||||
if not obj then -- no
|
if not obj then -- no
|
||||||
obj = ref(self.where):srch(what); -- in scene?
|
obj = stead.ref(self.where):srch(what); -- in scene?
|
||||||
if not obj then -- no!
|
if not obj then -- no!
|
||||||
return game.err, false;
|
return game.err, false;
|
||||||
end
|
end
|
||||||
|
@ -34,14 +34,14 @@ function player_use(self, what, onwhat, ...)
|
||||||
if scene_use_mode then
|
if scene_use_mode then
|
||||||
return self:action(what, ...); -- call act
|
return self:action(what, ...); -- call act
|
||||||
else
|
else
|
||||||
v, r = stead.call(ref(obj),'inv', ...); -- call inv
|
v, r = stead.call(stead.ref(obj),'inv', ...); -- call inv
|
||||||
end
|
end
|
||||||
if not v and r ~= true then
|
if not v and r ~= true then
|
||||||
v, r = stead.call(game, 'inv', obj, ...);
|
v, r = stead.call(game, 'inv', obj, ...);
|
||||||
end
|
end
|
||||||
return v, r;
|
return v, r;
|
||||||
end
|
end
|
||||||
obj2 = ref(self.where):srch(onwhat); -- in scene?
|
obj2 = stead.ref(self.where):srch(onwhat); -- in scene?
|
||||||
if not obj2 then
|
if not obj2 then
|
||||||
obj2 = self:srch(onwhat); -- in inv?
|
obj2 = self:srch(onwhat); -- in inv?
|
||||||
end
|
end
|
||||||
|
@ -49,8 +49,8 @@ function player_use(self, what, onwhat, ...)
|
||||||
return game.err, false;
|
return game.err, false;
|
||||||
end
|
end
|
||||||
|
|
||||||
obj = ref(obj)
|
obj = stead.ref(obj)
|
||||||
obj2 = ref(obj2)
|
obj2 = stead.ref(obj2)
|
||||||
|
|
||||||
if not scene_use_mode or isSceneUse(obj) then
|
if not scene_use_mode or isSceneUse(obj) then
|
||||||
v, r = stead.call(obj, 'use', obj2, ...);
|
v, r = stead.call(obj, 'use', obj2, ...);
|
||||||
|
@ -72,7 +72,7 @@ function player_use(self, what, onwhat, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function vobj_save(self, name, h, need)
|
function vobj_save(self, name, h, need)
|
||||||
local w = deref(self.where)
|
local w = stead.deref(self.where)
|
||||||
local dsc = self.dsc
|
local dsc = self.dsc
|
||||||
|
|
||||||
if need then
|
if need then
|
||||||
|
@ -87,27 +87,27 @@ end
|
||||||
|
|
||||||
function vobj_act(self, ...)
|
function vobj_act(self, ...)
|
||||||
local o, r = here():srch(self); -- self.nam
|
local o, r = here():srch(self); -- self.nam
|
||||||
if ref(o) and ref(o).where then
|
if stead.ref(o) and stead.ref(o).where then
|
||||||
return goto(ref(o).where);
|
return goto(stead.ref(o).where);
|
||||||
end
|
end
|
||||||
return stead.call(ref(r),'act', self.nam, ...);
|
return stead.call(stead.ref(r),'act', self.nam, ...);
|
||||||
end
|
end
|
||||||
|
|
||||||
function vobj_used(self, ...)
|
function vobj_used(self, ...)
|
||||||
local o, r = here():srch(self.nam);
|
local o, r = here():srch(self.nam);
|
||||||
return stead.call(ref(r),'used', self.nam, ...);
|
return stead.call(stead.ref(r),'used', self.nam, ...);
|
||||||
end
|
end
|
||||||
|
|
||||||
function vobj_use(self, ...)
|
function vobj_use(self, ...)
|
||||||
local o, r = here():srch(self.nam);
|
local o, r = here():srch(self.nam);
|
||||||
return stead.call(ref(r),'use', self.nam, ...);
|
return stead.call(stead.ref(r),'use', self.nam, ...);
|
||||||
end
|
end
|
||||||
|
|
||||||
function vobj(name, dsc, w)
|
function vobj(name, dsc, w)
|
||||||
return obj{ nam = tostring(name),
|
return obj{ nam = tostring(name),
|
||||||
vobject_type = true,
|
vobject_type = true,
|
||||||
dsc = dsc,
|
dsc = dsc,
|
||||||
where = deref(w),
|
where = stead.deref(w),
|
||||||
act = vobj_act,
|
act = vobj_act,
|
||||||
used = vobj_used,
|
used = vobj_used,
|
||||||
use = vobj_use,
|
use = vobj_use,
|
||||||
|
@ -120,7 +120,7 @@ function vway(name, dsc, w)
|
||||||
vobject_type = true,
|
vobject_type = true,
|
||||||
dsc = dsc,
|
dsc = dsc,
|
||||||
act = vobj_act,
|
act = vobj_act,
|
||||||
where = deref(w),
|
where = stead.deref(w),
|
||||||
used = vobj_used,
|
used = vobj_used,
|
||||||
use = vobj_use,
|
use = vobj_use,
|
||||||
save = vobj_save };
|
save = vobj_save };
|
||||||
|
@ -133,18 +133,18 @@ end
|
||||||
function list_check(self, name) -- force using of objects, instead refs
|
function list_check(self, name) -- force using of objects, instead refs
|
||||||
local i, v, ii;
|
local i, v, ii;
|
||||||
for i,v,ii in opairs(self) do
|
for i,v,ii in opairs(self) do
|
||||||
local o = ref(v);
|
local o = stead.ref(v);
|
||||||
if not isObject(o) then
|
if not isObject(o) then
|
||||||
error ("No object: "..tostring(v))
|
error ("No object: "..tostring(v))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if (v.auto_allocated and not ref(v.key_name)) -- renew
|
if (v.auto_allocated and not stead.ref(v.key_name)) -- renew
|
||||||
or (isObject(deref(v)) and not v._dynamic_type) then -- no named object!
|
or (isObject(stead.deref(v)) and not v._dynamic_type) then -- no named object!
|
||||||
local n = stead.string.format("%s[%d]", name, ii);
|
local n = stead.string.format("%s[%d]", name, ii);
|
||||||
v = allocator:new(n, n);
|
v = allocator:new(n, n);
|
||||||
self[ii] = v;
|
self[ii] = v;
|
||||||
v.auto_allocated = true;
|
v.auto_allocated = true;
|
||||||
for_each(v, n, check_list, isList, deref(v));
|
for_each(v, n, check_list, isList, stead.deref(v));
|
||||||
else
|
else
|
||||||
self[ii] = o;
|
self[ii] = o;
|
||||||
end
|
end
|
||||||
|
@ -155,7 +155,7 @@ end
|
||||||
function list_add(self, name, pos)
|
function list_add(self, name, pos)
|
||||||
local nam = name
|
local nam = name
|
||||||
if stead.initialized then
|
if stead.initialized then
|
||||||
nam = ref(name);
|
nam = stead.ref(name);
|
||||||
end
|
end
|
||||||
if not nam then
|
if not nam then
|
||||||
error ("Add wrong object to list: "..tostring(name), 2);
|
error ("Add wrong object to list: "..tostring(name), 2);
|
||||||
|
@ -164,7 +164,7 @@ function list_add(self, name, pos)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
self.__modified__ = true;
|
self.__modified__ = true;
|
||||||
if isObject(deref(nam)) then
|
if isObject(stead.deref(nam)) then
|
||||||
nam._dynamic_type = true
|
nam._dynamic_type = true
|
||||||
end
|
end
|
||||||
if tonumber(pos) then
|
if tonumber(pos) then
|
||||||
|
@ -183,12 +183,12 @@ function list_set(self, name, pos)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
if stead.initialized then
|
if stead.initialized then
|
||||||
nam = ref(name);
|
nam = stead.ref(name);
|
||||||
end
|
end
|
||||||
if not nam then
|
if not nam then
|
||||||
error ("Set wrong object in list: "..tostring(name), 2);
|
error ("Set wrong object in list: "..tostring(name), 2);
|
||||||
end
|
end
|
||||||
if isObject(deref(nam)) then
|
if isObject(stead.deref(nam)) then
|
||||||
nam._dynamic_type = true
|
nam._dynamic_type = true
|
||||||
end
|
end
|
||||||
self.__modified__ = true;
|
self.__modified__ = true;
|
||||||
|
@ -199,7 +199,7 @@ end
|
||||||
function list_concat(self, other, pos)
|
function list_concat(self, other, pos)
|
||||||
local n,o,ii
|
local n,o,ii
|
||||||
for n,o,ii in opairs(other) do
|
for n,o,ii in opairs(other) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
self:add(o);
|
self:add(o);
|
||||||
else
|
else
|
||||||
|
@ -214,7 +214,7 @@ stead.delim = '|'
|
||||||
function list_str(self)
|
function list_str(self)
|
||||||
local i, v, vv, o;
|
local i, v, vv, o;
|
||||||
for i,o in opairs(self) do
|
for i,o in opairs(self) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) and not isDisabled(o) then
|
if isObject(o) and not isDisabled(o) then
|
||||||
vv = nil
|
vv = nil
|
||||||
if game.gui then
|
if game.gui then
|
||||||
|
@ -239,7 +239,7 @@ function obj_str(self)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i,o in opairs(self.obj) do
|
for i,o in opairs(self.obj) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) and not isDisabled(o) then
|
if isObject(o) and not isDisabled(o) then
|
||||||
vv = nil
|
vv = nil
|
||||||
if game.gui then
|
if game.gui then
|
||||||
|
@ -259,10 +259,10 @@ function path(w, wh) -- search in way, disabled too
|
||||||
if not wh then
|
if not wh then
|
||||||
wh = here();
|
wh = here();
|
||||||
else
|
else
|
||||||
wh = ref(wh);
|
wh = stead.ref(wh);
|
||||||
end
|
end
|
||||||
local o = ways(wh):srch(w, true);
|
local o = ways(wh):srch(w, true);
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isRoom(o) then
|
if isRoom(o) then
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
|
266
stead/stead.lua
266
stead/stead.lua
|
@ -87,8 +87,8 @@ stead.tostring = function(v)
|
||||||
v = stead.string.format("%q", v);
|
v = stead.string.format("%q", v);
|
||||||
elseif v == nil or type(v) == 'boolean' or type(v) == 'number' then
|
elseif v == nil or type(v) == 'boolean' or type(v) == 'number' then
|
||||||
v = tostring(v);
|
v = tostring(v);
|
||||||
elseif type(v) == 'table' and type(deref(v)) == 'string' then
|
elseif type(v) == 'table' and type(stead.deref(v)) == 'string' then
|
||||||
v = deref(v);
|
v = stead.deref(v);
|
||||||
else
|
else
|
||||||
v = nil
|
v = nil
|
||||||
end
|
end
|
||||||
|
@ -413,7 +413,7 @@ function obj_look(self)
|
||||||
v = stead.string.gsub(v, '[{}]','');
|
v = stead.string.gsub(v, '[{}]','');
|
||||||
end
|
end
|
||||||
for i,o in opairs(self.obj) do
|
for i,o in opairs(self.obj) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
vv = obj_look(o);
|
vv = obj_look(o);
|
||||||
v = stead.par(' ',v, vv);
|
v = stead.par(' ',v, vv);
|
||||||
|
@ -475,7 +475,7 @@ function obj_str(self)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i,o in opairs(self.obj) do
|
for i,o in opairs(self.obj) do
|
||||||
o = 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 = xref(vv, o);
|
||||||
|
@ -539,14 +539,14 @@ function obj(v)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ref(n, nofunc) -- ref object by name
|
function stead.ref(n, nofunc) -- ref object by name
|
||||||
if type(n) == 'string' then
|
if type(n) == 'string' then
|
||||||
if type(_G[n]) == 'table' then -- fastest path
|
if type(_G[n]) == 'table' then -- fastest path
|
||||||
return _G[n];
|
return _G[n];
|
||||||
end
|
end
|
||||||
local f = loadstring('return '..n);
|
local f = loadstring('return '..n);
|
||||||
if f then
|
if f then
|
||||||
return ref(f(), nofunc);
|
return stead.ref(f(), nofunc);
|
||||||
end
|
end
|
||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
|
@ -558,12 +558,13 @@ function ref(n, nofunc) -- ref object by name
|
||||||
if not r then
|
if not r then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
return ref(v);
|
return stead.ref(v);
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
ref = stead.ref
|
||||||
|
|
||||||
function deref(n)
|
function stead.deref(n)
|
||||||
if type(n) == 'string' then
|
if type(n) == 'string' then
|
||||||
return n
|
return n
|
||||||
end
|
end
|
||||||
|
@ -573,17 +574,18 @@ function deref(n)
|
||||||
end
|
end
|
||||||
return n
|
return n
|
||||||
end
|
end
|
||||||
|
deref = stead.deref
|
||||||
|
|
||||||
function list_check(self, name)
|
function list_check(self, name)
|
||||||
local i, v, ii;
|
local i, v, ii;
|
||||||
for i,v,ii in opairs(self) do
|
for i,v,ii in opairs(self) do
|
||||||
local o = ref(v);
|
local o = stead.ref(v);
|
||||||
if not o then -- isObject(o) then -- compat
|
if not o then -- isObject(o) then -- compat
|
||||||
error ("No object: "..tostring(v))
|
error ("No object: "..tostring(v))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if deref(v) then
|
if stead.deref(v) then
|
||||||
self[ii] = deref(v);
|
self[ii] = stead.deref(v);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return true;
|
return true;
|
||||||
|
@ -592,7 +594,7 @@ end
|
||||||
function list_str(self)
|
function list_str(self)
|
||||||
local i, v, vv, o;
|
local i, v, vv, o;
|
||||||
for i,o in opairs(self) do
|
for i,o in opairs(self) do
|
||||||
o = 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 = xref(vv, o);
|
||||||
|
@ -605,7 +607,7 @@ end
|
||||||
|
|
||||||
function list_add(self, name, pos)
|
function list_add(self, name, pos)
|
||||||
local nam
|
local nam
|
||||||
nam = deref(name);
|
nam = stead.deref(name);
|
||||||
if self:look(nam) then
|
if self:look(nam) then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
@ -625,7 +627,7 @@ function list_set(self, name, pos)
|
||||||
if not i then
|
if not i then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
nam = deref(name);
|
nam = stead.deref(name);
|
||||||
self.__modified__ = true;
|
self.__modified__ = true;
|
||||||
self[i] = nam; -- for spare lists
|
self[i] = nam; -- for spare lists
|
||||||
return true
|
return true
|
||||||
|
@ -634,7 +636,7 @@ end
|
||||||
function list_find(self, name)
|
function list_find(self, name)
|
||||||
local n, v, ii
|
local n, v, ii
|
||||||
for n,v,ii in opairs(self) do
|
for n,v,ii in opairs(self) do
|
||||||
if ref(v) == ref(name, true) then -- do not call func while search
|
if stead.ref(v) == stead.ref(name, true) then -- do not call func while search
|
||||||
return ii;
|
return ii;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -644,7 +646,7 @@ end
|
||||||
function list_disable_all(s)
|
function list_disable_all(s)
|
||||||
local k,v
|
local k,v
|
||||||
for k,v in opairs(s) do
|
for k,v in opairs(s) do
|
||||||
local o = ref(v);
|
local o = stead.ref(v);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o:disable()
|
o:disable()
|
||||||
end
|
end
|
||||||
|
@ -654,7 +656,7 @@ end
|
||||||
function list_enable_all(s)
|
function list_enable_all(s)
|
||||||
local k,v
|
local k,v
|
||||||
for k,v in opairs(s) do
|
for k,v in opairs(s) do
|
||||||
local o = ref(v);
|
local o = stead.ref(v);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o:enable()
|
o:enable()
|
||||||
end
|
end
|
||||||
|
@ -672,7 +674,7 @@ end
|
||||||
function list_name(self, name, dis)
|
function list_name(self, name, dis)
|
||||||
local n, o, ii
|
local n, o, ii
|
||||||
for n,o,ii in opairs(self) do
|
for n,o,ii in opairs(self) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
local nam = stead.call(o,'nam') ;
|
local nam = stead.call(o,'nam') ;
|
||||||
if ( not isDisabled(o) or dis ) and name == tostring(nam) then
|
if ( not isDisabled(o) or dis ) and name == tostring(nam) then
|
||||||
|
@ -685,7 +687,7 @@ end
|
||||||
function list_id(self, id, dis)
|
function list_id(self, id, dis)
|
||||||
local n,o,ii
|
local n,o,ii
|
||||||
for n,o,ii in opairs(self) do
|
for n,o,ii in opairs(self) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if dis or not isDisabled(o) then
|
if dis or not isDisabled(o) then
|
||||||
if isObject(o) and id == o.id then
|
if isObject(o) and id == o.id then
|
||||||
return ii;
|
return ii;
|
||||||
|
@ -706,7 +708,7 @@ function list_search(self, n, dis)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not dis and isDisabled(ref(self[i])) then
|
if not dis and isDisabled(stead.ref(self[i])) then
|
||||||
return nil;
|
return nil;
|
||||||
end
|
end
|
||||||
return self[i], i;
|
return self[i], i;
|
||||||
|
@ -724,11 +726,11 @@ end
|
||||||
function list_concat(self, other, pos)
|
function list_concat(self, other, pos)
|
||||||
local n,o,ii
|
local n,o,ii
|
||||||
for n,o,ii in opairs(other) do
|
for n,o,ii in opairs(other) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if pos == nil then
|
if pos == nil then
|
||||||
self:add(deref(o));
|
self:add(stead.deref(o));
|
||||||
else
|
else
|
||||||
self:add(deref(o), pos);
|
self:add(stead.deref(o), pos);
|
||||||
pos = pos + 1;
|
pos = pos + 1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -893,7 +895,7 @@ end
|
||||||
function room_look(self)
|
function room_look(self)
|
||||||
local i, vv, o;
|
local i, vv, o;
|
||||||
for i,o in opairs(self.obj) do
|
for i,o in opairs(self.obj) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
vv = stead.par(' ',vv, o:look());
|
vv = stead.par(' ',vv, o:look());
|
||||||
end
|
end
|
||||||
|
@ -912,7 +914,7 @@ function obj_search(v, n, dis)
|
||||||
return o, v;
|
return o, v;
|
||||||
end
|
end
|
||||||
for i,o in opairs(v.obj) do
|
for i,o in opairs(v.obj) do
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
local r,rr = obj_search(o, n, dis);
|
local r,rr = obj_search(o, n, dis);
|
||||||
if r then
|
if r then
|
||||||
|
@ -972,7 +974,7 @@ function dialog_look(self)
|
||||||
local i,n,v,ph
|
local i,n,v,ph
|
||||||
n = 1
|
n = 1
|
||||||
for i,ph in opairs(self.obj) do
|
for i,ph in opairs(self.obj) do
|
||||||
ph = ref(ph);
|
ph = stead.ref(ph);
|
||||||
if isPhrase(ph) and not isDisabled(ph) then
|
if isPhrase(ph) and not isDisabled(ph) then
|
||||||
v = stead.par('^', v, txtnm(n, ph:look()));
|
v = stead.par('^', v, txtnm(n, ph:look()));
|
||||||
n = n + 1
|
n = n + 1
|
||||||
|
@ -985,7 +987,7 @@ function dialog_rescan(self)
|
||||||
local i,k,ph
|
local i,k,ph
|
||||||
k = 1
|
k = 1
|
||||||
for i,ph in opairs(self.obj) do
|
for i,ph in opairs(self.obj) do
|
||||||
ph = ref(ph);
|
ph = stead.ref(ph);
|
||||||
if isPhrase(ph) and not isDisabled(ph) then
|
if isPhrase(ph) and not isDisabled(ph) then
|
||||||
ph.nam = tostring(k);
|
ph.nam = tostring(k);
|
||||||
k = k + 1;
|
k = k + 1;
|
||||||
|
@ -1003,12 +1005,12 @@ end
|
||||||
|
|
||||||
function dialog_phrase(self, num)
|
function dialog_phrase(self, num)
|
||||||
if not tonumber(num) then
|
if not tonumber(num) then
|
||||||
if isPhrase(ref(num)) then
|
if isPhrase(stead.ref(num)) then
|
||||||
return ref(num);
|
return stead.ref(num);
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
return ref(self.obj[tonumber(num)]);
|
return stead.ref(self.obj[tonumber(num)]);
|
||||||
end
|
end
|
||||||
|
|
||||||
function phrase_seen(s, enb, ...)
|
function phrase_seen(s, enb, ...)
|
||||||
|
@ -1207,15 +1209,15 @@ function player_inv(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_ways(self)
|
function player_ways(self)
|
||||||
return iface:ways(stead.cat(ref(self.where).way:str()));
|
return iface:ways(stead.cat(stead.ref(self.where).way:str()));
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_objs(self)
|
function player_objs(self)
|
||||||
return iface:objs(stead.cat(ref(self.where):str()));
|
return iface:objs(stead.cat(stead.ref(self.where):str()));
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_look(self)
|
function player_look(self)
|
||||||
return ref(self.where):scene();
|
return stead.ref(self.where):scene();
|
||||||
end
|
end
|
||||||
|
|
||||||
function obj_tag(self, id)
|
function obj_tag(self, id)
|
||||||
|
@ -1226,7 +1228,7 @@ function obj_tag(self, id)
|
||||||
end
|
end
|
||||||
|
|
||||||
for k,v in opairs(self.obj) do
|
for k,v in opairs(self.obj) do
|
||||||
v = ref(v);
|
v = stead.ref(v);
|
||||||
if isObject(v) and not isDisabled(v) then
|
if isObject(v) and not isDisabled(v) then
|
||||||
id = id + 1;
|
id = id + 1;
|
||||||
v.id = id;
|
v.id = id;
|
||||||
|
@ -1244,7 +1246,7 @@ function player_tagall(self)
|
||||||
id = obj_tag(me(), id);
|
id = obj_tag(me(), id);
|
||||||
|
|
||||||
for k,v in opairs(ways()) do
|
for k,v in opairs(ways()) do
|
||||||
v = ref(v);
|
v = stead.ref(v);
|
||||||
if isRoom(v) and not isDisabled(v) then
|
if isRoom(v) and not isDisabled(v) then
|
||||||
id = id + 1;
|
id = id + 1;
|
||||||
v.id = id;
|
v.id = id;
|
||||||
|
@ -1254,15 +1256,15 @@ end
|
||||||
|
|
||||||
function player_action(self, what, ...)
|
function player_action(self, what, ...)
|
||||||
local v,r,obj
|
local v,r,obj
|
||||||
obj = ref(self.where):srch(what);
|
obj = stead.ref(self.where):srch(what);
|
||||||
if not obj then
|
if not obj then
|
||||||
return stead.call(ref(game), 'action', what, ...); --player_do(self, what, ...);
|
return stead.call(stead.ref(game), 'action', what, ...); --player_do(self, what, ...);
|
||||||
end
|
end
|
||||||
v, r = player_take(self, what, ...);
|
v, r = player_take(self, what, ...);
|
||||||
if not v then
|
if not v then
|
||||||
v, r = stead.call(ref(obj), 'act', ...);
|
v, r = stead.call(stead.ref(obj), 'act', ...);
|
||||||
if not v and r ~= true then
|
if not v and r ~= true then
|
||||||
v, r = stead.call(ref(game), 'act', obj, ...);
|
v, r = stead.call(stead.ref(game), 'act', obj, ...);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return v, r;
|
return v, r;
|
||||||
|
@ -1270,11 +1272,11 @@ end
|
||||||
|
|
||||||
function player_take(self, what, ...)
|
function player_take(self, what, ...)
|
||||||
local v,r,obj,w
|
local v,r,obj,w
|
||||||
obj,w = ref(self.where):srch(what);
|
obj,w = stead.ref(self.where):srch(what);
|
||||||
if not obj then
|
if not obj then
|
||||||
return nil, false;
|
return nil, false;
|
||||||
end
|
end
|
||||||
v,r = stead.call(ref(obj), 'tak', ...);
|
v,r = stead.call(stead.ref(obj), 'tak', ...);
|
||||||
if v and r ~= false then
|
if v and r ~= false then
|
||||||
take(obj, w);
|
take(obj, w);
|
||||||
end
|
end
|
||||||
|
@ -1287,7 +1289,7 @@ function player_use(self, what, onwhat, ...)
|
||||||
|
|
||||||
obj = self:srch(what); -- in inv?
|
obj = self:srch(what); -- in inv?
|
||||||
if not obj then -- no
|
if not obj then -- no
|
||||||
obj = ref(self.where):srch(what); -- in scene?
|
obj = stead.ref(self.where):srch(what); -- in scene?
|
||||||
if not obj then -- no!
|
if not obj then -- no!
|
||||||
return game.err, false;
|
return game.err, false;
|
||||||
end
|
end
|
||||||
|
@ -1297,24 +1299,24 @@ function player_use(self, what, onwhat, ...)
|
||||||
if scene_use_mode then
|
if scene_use_mode then
|
||||||
return self:action(what, ...); -- call act
|
return self:action(what, ...); -- call act
|
||||||
else
|
else
|
||||||
v, r = stead.call(ref(obj),'inv', ...); -- call inv
|
v, r = stead.call(stead.ref(obj),'inv', ...); -- call inv
|
||||||
end
|
end
|
||||||
if not v and r ~= true then
|
if not v and r ~= true then
|
||||||
v, r = stead.call(game, 'inv', obj, ...);
|
v, r = stead.call(game, 'inv', obj, ...);
|
||||||
end
|
end
|
||||||
return v, r;
|
return v, r;
|
||||||
end
|
end
|
||||||
obj2 = ref(self.where):srch(onwhat); -- in scene?
|
obj2 = stead.ref(self.where):srch(onwhat); -- in scene?
|
||||||
if not obj2 then
|
if not obj2 then
|
||||||
obj2 = self:srch(onwhat); -- in inv?
|
obj2 = self:srch(onwhat); -- in inv?
|
||||||
end
|
end
|
||||||
if not obj2 or obj2 == obj then
|
if not obj2 or obj2 == obj then
|
||||||
return game.err, false;
|
return game.err, false;
|
||||||
end
|
end
|
||||||
if not scene_use_mode or isSceneUse(ref(obj)) then
|
if not scene_use_mode or isSceneUse(stead.ref(obj)) then
|
||||||
v, r = stead.call(ref(obj), 'use', obj2, ...);
|
v, r = stead.call(stead.ref(obj), 'use', obj2, ...);
|
||||||
if r ~= false then
|
if r ~= false then
|
||||||
vv = stead.call(ref(obj2), 'used', obj, ...);
|
vv = stead.call(stead.ref(obj2), 'used', obj, ...);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not v and not vv then
|
if not v and not vv then
|
||||||
|
@ -1324,7 +1326,7 @@ function player_use(self, what, onwhat, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_back(self)
|
function player_back(self)
|
||||||
local where = ref(self.where);
|
local where = stead.ref(self.where);
|
||||||
if where == nil then
|
if where == nil then
|
||||||
return nil,false
|
return nil,false
|
||||||
end
|
end
|
||||||
|
@ -1347,10 +1349,10 @@ function go(self, where, back)
|
||||||
if where == nil then
|
if where == nil then
|
||||||
return nil,ret(false)
|
return nil,ret(false)
|
||||||
end
|
end
|
||||||
if not isRoom(ref(where)) then
|
if not isRoom(stead.ref(where)) then
|
||||||
error ("Trying to go nowhere: "..where, 2);
|
error ("Trying to go nowhere: "..where, 2);
|
||||||
end
|
end
|
||||||
if not isRoom(ref(self.where)) then
|
if not isRoom(stead.ref(self.where)) then
|
||||||
error ("Trying to go from nowhere: "..self.where, 2);
|
error ("Trying to go from nowhere: "..self.where, 2);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1359,9 +1361,9 @@ function go(self, where, back)
|
||||||
end
|
end
|
||||||
|
|
||||||
local v, r;
|
local v, r;
|
||||||
if not isVroom(ref(where)) and not stead.in_exit_call then
|
if not isVroom(stead.ref(where)) and not stead.in_exit_call then
|
||||||
stead.in_exit_call = true -- to break recurse
|
stead.in_exit_call = true -- to break recurse
|
||||||
v,r = stead.call(ref(self.where), 'exit', where);
|
v,r = stead.call(stead.ref(self.where), 'exit', where);
|
||||||
stead.in_exit_call = nil
|
stead.in_exit_call = nil
|
||||||
if r == false then
|
if r == false then
|
||||||
return v, ret(r)
|
return v, ret(r)
|
||||||
|
@ -1371,30 +1373,30 @@ function go(self, where, back)
|
||||||
local res = v;
|
local res = v;
|
||||||
|
|
||||||
v = nil;
|
v = nil;
|
||||||
if not back or not isDialog(ref(self.where)) or isDialog(ref(where)) then
|
if not back or not isDialog(stead.ref(self.where)) or isDialog(stead.ref(where)) then
|
||||||
v, r = stead.call(ref(where), 'enter', self.where);
|
v, r = stead.call(stead.ref(where), 'enter', self.where);
|
||||||
if r == false then
|
if r == false then
|
||||||
return v, ret(r)
|
return v, ret(r)
|
||||||
end
|
end
|
||||||
need_scene = true;
|
need_scene = true;
|
||||||
if ref(was) ~= ref(self.where) then -- jump !!!
|
if stead.ref(was) ~= stead.ref(self.where) then -- jump !!!
|
||||||
where = deref(self.where);
|
where = stead.deref(self.where);
|
||||||
need_scene = false;
|
need_scene = false;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
res = stead.par('^^',res,v);
|
res = stead.par('^^',res,v);
|
||||||
|
|
||||||
if not back then
|
if not back then
|
||||||
ref(where).__from__ = deref(self.where);
|
stead.ref(where).__from__ = stead.deref(self.where);
|
||||||
end
|
end
|
||||||
|
|
||||||
self.where = deref(where);
|
self.where = stead.deref(where);
|
||||||
|
|
||||||
ret();
|
ret();
|
||||||
|
|
||||||
PLAYER_MOVED = true
|
PLAYER_MOVED = true
|
||||||
if need_scene then -- or isForcedsc(ref(where)) then -- i'am not sure...
|
if need_scene then -- or isForcedsc(stead.ref(where)) then -- i'am not sure...
|
||||||
return stead.par('^^',res,ref(where):scene());
|
return stead.par('^^', res, stead.ref(where):scene());
|
||||||
end
|
end
|
||||||
return res;
|
return res;
|
||||||
end
|
end
|
||||||
|
@ -1405,7 +1407,7 @@ function player_goto(self, where, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_go(self, where)
|
function player_go(self, where)
|
||||||
local w = ref(self.where).way:srch(where);
|
local w = stead.ref(self.where).way:srch(where);
|
||||||
if not w then
|
if not w then
|
||||||
return nil,false
|
return nil,false
|
||||||
end
|
end
|
||||||
|
@ -1414,7 +1416,7 @@ function player_go(self, where)
|
||||||
end
|
end
|
||||||
|
|
||||||
function player_save(self, name, h)
|
function player_save(self, name, h)
|
||||||
h:write(tostring(name)..".where = '"..deref(self.where).."';\n");
|
h:write(tostring(name)..".where = '"..stead.deref(self.where).."';\n");
|
||||||
savemembers(h, self, name, false);
|
savemembers(h, self, name, false);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1471,7 +1473,7 @@ function game_life(self)
|
||||||
for i,o in opairs(self.lifes) do
|
for i,o in opairs(self.lifes) do
|
||||||
local vv
|
local vv
|
||||||
local pre
|
local pre
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if not isDisabled(o) then
|
if not isDisabled(o) then
|
||||||
PLAYER_MOVED = false
|
PLAYER_MOVED = false
|
||||||
vv,pre = stead.call(o, 'life');
|
vv,pre = stead.call(o, 'life');
|
||||||
|
@ -1512,7 +1514,7 @@ function check_room(k, v)
|
||||||
end
|
end
|
||||||
|
|
||||||
function check_player(k, v)
|
function check_player(k, v)
|
||||||
v.where = deref(v.where);
|
v.where = stead.deref(v.where);
|
||||||
end
|
end
|
||||||
|
|
||||||
function check_object(k, v)
|
function check_object(k, v)
|
||||||
|
@ -1525,7 +1527,7 @@ function check_object(k, v)
|
||||||
if isPlayer(v) then
|
if isPlayer(v) then
|
||||||
check_player(k, v);
|
check_player(k, v);
|
||||||
end
|
end
|
||||||
for_each(v, k, check_list, isList, deref(v))
|
for_each(v, k, check_list, isList, stead.deref(v))
|
||||||
end
|
end
|
||||||
|
|
||||||
function for_everything(f, ...)
|
function for_everything(f, ...)
|
||||||
|
@ -1549,15 +1551,15 @@ function do_ini(self, load)
|
||||||
math.randomseed(os.time(os.date("*t")))
|
math.randomseed(os.time(os.date("*t")))
|
||||||
rnd(1); rnd(2); rnd(3); -- Lua bug?
|
rnd(1); rnd(2); rnd(3); -- Lua bug?
|
||||||
|
|
||||||
game.pl = deref(game.pl);
|
game.pl = stead.deref(game.pl);
|
||||||
game.where = deref(game.where);
|
game.where = stead.deref(game.where);
|
||||||
|
|
||||||
if not load then
|
if not load then
|
||||||
for_each_object(call_key);
|
for_each_object(call_key);
|
||||||
for_each_codeblock(call_codekey);
|
for_each_codeblock(call_codekey);
|
||||||
for_each_object(check_object);
|
for_each_object(check_object);
|
||||||
call_key("game", game);
|
call_key("game", game);
|
||||||
for_each(game, "game", check_list, isList, deref(game))
|
for_each(game, "game", check_list, isList, stead.deref(game))
|
||||||
end
|
end
|
||||||
for_each_object(call_ini, load);
|
for_each_object(call_ini, load);
|
||||||
me():tag();
|
me():tag();
|
||||||
|
@ -1625,7 +1627,7 @@ function game(v)
|
||||||
end
|
end
|
||||||
|
|
||||||
function live(v)
|
function live(v)
|
||||||
return ref(game.lifes:srch(v));
|
return stead.ref(game.lifes:srch(v));
|
||||||
end
|
end
|
||||||
|
|
||||||
function isEnableSave()
|
function isEnableSave()
|
||||||
|
@ -1752,7 +1754,7 @@ function savevar (h, v, n, need)
|
||||||
v:save(v.key_name, h, false, true); -- here todo
|
v:save(v.key_name, h, false, true); -- here todo
|
||||||
end
|
end
|
||||||
if need then
|
if need then
|
||||||
if ref(v.key_name) == nil then
|
if stead.ref(v.key_name) == nil then
|
||||||
v.key_name = 'null'
|
v.key_name = 'null'
|
||||||
end
|
end
|
||||||
h:write(stead.string.format("%s = %s\n", n, v.key_name));
|
h:write(stead.string.format("%s = %s\n", n, v.key_name));
|
||||||
|
@ -1857,7 +1859,7 @@ function game_save(self, name, file)
|
||||||
local h;
|
local h;
|
||||||
|
|
||||||
if file ~= nil then
|
if file ~= nil then
|
||||||
file:write(name..".pl = '"..deref(self.pl).."'\n");
|
file:write(name..".pl = '"..stead.deref(self.pl).."'\n");
|
||||||
savemembers(file, self, name, false);
|
savemembers(file, self, name, false);
|
||||||
return nil, true
|
return nil, true
|
||||||
end
|
end
|
||||||
|
@ -1997,12 +1999,12 @@ iface = {
|
||||||
return n..' - '..str;
|
return n..' - '..str;
|
||||||
end,
|
end,
|
||||||
xref = function(self, str, obj)
|
xref = function(self, str, obj)
|
||||||
local o = ref(here():srch(obj));
|
local o = stead.ref(here():srch(obj));
|
||||||
if not o then
|
if not o then
|
||||||
o = ref(ways():srch(obj));
|
o = stead.ref(ways():srch(obj));
|
||||||
end
|
end
|
||||||
if not o then
|
if not o then
|
||||||
o = ref(me():srch(obj));
|
o = stead.ref(me():srch(obj));
|
||||||
end
|
end
|
||||||
if not o or not o.id then
|
if not o or not o.id then
|
||||||
return str;
|
return str;
|
||||||
|
@ -2152,28 +2154,28 @@ iface = {
|
||||||
|
|
||||||
|
|
||||||
function me()
|
function me()
|
||||||
return ref(game.pl);
|
return stead.ref(game.pl);
|
||||||
end
|
end
|
||||||
|
|
||||||
function where(s)
|
function where(s)
|
||||||
if not isObject(ref(s)) then error("Wrong parameter to where.", 2); end
|
if not isObject(stead.ref(s)) then error("Wrong parameter to where.", 2); end
|
||||||
if isPlayer(ref(s)) then
|
if isPlayer(stead.ref(s)) then
|
||||||
return ref(ref(s).where);
|
return stead.ref(stead.ref(s).where);
|
||||||
end
|
end
|
||||||
return ref(ref(s).__where__);
|
return stead.ref(stead.ref(s).__where__);
|
||||||
end
|
end
|
||||||
|
|
||||||
function here()
|
function here()
|
||||||
return ref(me().where);
|
return stead.ref(me().where);
|
||||||
end
|
end
|
||||||
|
|
||||||
function from(w)
|
function from(w)
|
||||||
if w == nil then
|
if w == nil then
|
||||||
w = here();
|
w = here();
|
||||||
else
|
else
|
||||||
w = ref(w);
|
w = stead.ref(w);
|
||||||
end
|
end
|
||||||
return ref(w.__from__);
|
return stead.ref(w.__from__);
|
||||||
end
|
end
|
||||||
|
|
||||||
function time()
|
function time()
|
||||||
|
@ -2189,7 +2191,7 @@ function objs(w)
|
||||||
if not w then
|
if not w then
|
||||||
return here().obj;
|
return here().obj;
|
||||||
else
|
else
|
||||||
return ref(w).obj;
|
return stead.ref(w).obj;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2197,7 +2199,7 @@ function ways(w)
|
||||||
if not w then
|
if not w then
|
||||||
return here().way;
|
return here().way;
|
||||||
else
|
else
|
||||||
return ref(w).way;
|
return stead.ref(w).way;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2293,7 +2295,7 @@ end
|
||||||
|
|
||||||
function vobj_save(self, name, h, need)
|
function vobj_save(self, name, h, need)
|
||||||
local dsc = self.dsc;
|
local dsc = self.dsc;
|
||||||
local w = deref(self.where);
|
local w = stead.deref(self.where);
|
||||||
|
|
||||||
if need then
|
if need then
|
||||||
h:write(stead.string.format("%s = vobj(%s, %s, %s, %s);\n",
|
h:write(stead.string.format("%s = vobj(%s, %s, %s, %s);\n",
|
||||||
|
@ -2309,32 +2311,32 @@ end
|
||||||
|
|
||||||
function vobj_act(self, ...)
|
function vobj_act(self, ...)
|
||||||
local o, r = here():srch(self); -- self.nam
|
local o, r = here():srch(self); -- self.nam
|
||||||
if ref(o) and ref(o).where then
|
if stead.ref(o) and stead.ref(o).where then
|
||||||
return goto(ref(o).where);
|
return goto(stead.ref(o).where);
|
||||||
end
|
end
|
||||||
return stead.call(ref(r),'act', self.key, ...);
|
return stead.call(stead.ref(r),'act', self.key, ...);
|
||||||
end
|
end
|
||||||
|
|
||||||
function vobj_used(self, ...)
|
function vobj_used(self, ...)
|
||||||
local o, r = here():srch(self.nam);
|
local o, r = here():srch(self.nam);
|
||||||
return stead.call(ref(r),'used', self.key, ...);
|
return stead.call(stead.ref(r),'used', self.key, ...);
|
||||||
end
|
end
|
||||||
|
|
||||||
function vobj(key, name, dsc, w)
|
function vobj(key, name, dsc, w)
|
||||||
if not tonumber(key) then
|
if not tonumber(key) then
|
||||||
error ("vobj key must be number!", 2);
|
error ("vobj key must be number!", 2);
|
||||||
end
|
end
|
||||||
return obj{ key = key, nam = name, dsc = dsc, where = deref(w), act = vobj_act, used = vobj_used, save = vobj_save, obj = list({}) };
|
return obj{ key = key, nam = name, dsc = dsc, where = stead.deref(w), act = vobj_act, used = vobj_used, save = vobj_save, obj = list({}) };
|
||||||
end
|
end
|
||||||
|
|
||||||
function vway(name, dsc, w)
|
function vway(name, dsc, w)
|
||||||
-- o.object_type = true;
|
-- o.object_type = true;
|
||||||
return obj{ key = -1, nam = name, dsc = dsc, act = vobj_act, where = deref(w), used = vobj_used, save = vobj_save, obj = list({}), };
|
return obj{ key = -1, nam = name, dsc = dsc, act = vobj_act, where = stead.deref(w), used = vobj_used, save = vobj_save, obj = list({}), };
|
||||||
end
|
end
|
||||||
|
|
||||||
function vroom_save(self, name, h, need)
|
function vroom_save(self, name, h, need)
|
||||||
if need then
|
if need then
|
||||||
h:write(name.." = vroom('"..self.nam.."','"..deref(self.where).."');\n");
|
h:write(name.." = vroom('"..self.nam.."','"..stead.deref(self.where).."');\n");
|
||||||
end
|
end
|
||||||
savemembers(h, self, name,false);
|
savemembers(h, self, name,false);
|
||||||
end
|
end
|
||||||
|
@ -2351,7 +2353,7 @@ function vroom(name, w)
|
||||||
if w == nil then
|
if w == nil then
|
||||||
error("Wrong parameter to vroom.", 2);
|
error("Wrong parameter to vroom.", 2);
|
||||||
end
|
end
|
||||||
return room { vroom_type = true, nam = name, where = deref(w), enter = vroom_enter, save = vroom_save, };
|
return room { vroom_type = true, nam = name, where = stead.deref(w), enter = vroom_enter, save = vroom_save, };
|
||||||
end
|
end
|
||||||
|
|
||||||
function goto(what)
|
function goto(what)
|
||||||
|
@ -2374,7 +2376,7 @@ function rnd(m)
|
||||||
end
|
end
|
||||||
|
|
||||||
function taken(obj)
|
function taken(obj)
|
||||||
if isObject(ref(obj)) and ref(obj)._taken then
|
if isObject(stead.ref(obj)) and stead.ref(obj)._taken then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false;
|
return false;
|
||||||
|
@ -2383,16 +2385,16 @@ end
|
||||||
function remove(obj, from)
|
function remove(obj, from)
|
||||||
local o,w
|
local o,w
|
||||||
if from then
|
if from then
|
||||||
o,w = ref(from):srch(obj);
|
o,w = stead.ref(from):srch(obj);
|
||||||
else
|
else
|
||||||
o,w = here():srch(obj);
|
o,w = here():srch(obj);
|
||||||
end
|
end
|
||||||
if w then
|
if w then
|
||||||
ref(w).obj:del(obj);
|
stead.ref(w).obj:del(obj);
|
||||||
end
|
end
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if not isObject(o) then
|
if not isObject(o) then
|
||||||
o = ref(obj);
|
o = stead.ref(obj);
|
||||||
end
|
end
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o.__where__ = nil;
|
o.__where__ = nil;
|
||||||
|
@ -2403,16 +2405,16 @@ end
|
||||||
function purge(obj, from)
|
function purge(obj, from)
|
||||||
local o,w
|
local o,w
|
||||||
if from then
|
if from then
|
||||||
o,w = ref(from):srch(obj, true);
|
o,w = stead.ref(from):srch(obj, true);
|
||||||
else
|
else
|
||||||
o,w = here():srch(obj, true);
|
o,w = here():srch(obj, true);
|
||||||
end
|
end
|
||||||
if w then
|
if w then
|
||||||
ref(w).obj:purge(obj);
|
stead.ref(w).obj:purge(obj);
|
||||||
end
|
end
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if not isObject(o) then
|
if not isObject(o) then
|
||||||
o = ref(obj);
|
o = stead.ref(obj);
|
||||||
end
|
end
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o.__where__ = nil;
|
o.__where__ = nil;
|
||||||
|
@ -2427,7 +2429,7 @@ function taketo(obj, wh, pos)
|
||||||
end
|
end
|
||||||
inv():add(obj, pos);
|
inv():add(obj, pos);
|
||||||
o._taken = true
|
o._taken = true
|
||||||
wh = deref(me())
|
wh = stead.deref(me())
|
||||||
if type(wh) == 'string' then
|
if type(wh) == 'string' then
|
||||||
o.__where__ = wh;
|
o.__where__ = wh;
|
||||||
end
|
end
|
||||||
|
@ -2444,16 +2446,16 @@ end
|
||||||
|
|
||||||
function putto(obj, w, pos)
|
function putto(obj, w, pos)
|
||||||
local wh
|
local wh
|
||||||
local o = ref(obj);
|
local o = stead.ref(obj);
|
||||||
if not isObject(o) then
|
if not isObject(o) then
|
||||||
error ("Trying to put wrong object.", 2);
|
error ("Trying to put wrong object.", 2);
|
||||||
end
|
end
|
||||||
if not w then
|
if not w then
|
||||||
wh = deref(here());
|
wh = stead.deref(here());
|
||||||
w = here();
|
w = here();
|
||||||
else
|
else
|
||||||
wh = deref(w);
|
wh = stead.deref(w);
|
||||||
w = ref(w);
|
w = stead.ref(w);
|
||||||
end
|
end
|
||||||
w.obj:add(obj, pos);
|
w.obj:add(obj, pos);
|
||||||
if type(wh) == 'string' then
|
if type(wh) == 'string' then
|
||||||
|
@ -2477,23 +2479,23 @@ placeto = putto
|
||||||
|
|
||||||
function replace(obj, obj2, from)
|
function replace(obj, obj2, from)
|
||||||
local o,w,i
|
local o,w,i
|
||||||
if not isObject(ref(obj2)) then
|
if not isObject(stead.ref(obj2)) then
|
||||||
error ("Wrong parameter to replace.", 2);
|
error ("Wrong parameter to replace.", 2);
|
||||||
end
|
end
|
||||||
if from then
|
if from then
|
||||||
o,w = ref(from):srch(obj);
|
o,w = stead.ref(from):srch(obj);
|
||||||
else
|
else
|
||||||
o,w = here():srch(obj);
|
o,w = here():srch(obj);
|
||||||
end
|
end
|
||||||
if w then
|
if w then
|
||||||
ref(w).obj:replace(o, obj2);
|
stead.ref(w).obj:replace(o, obj2);
|
||||||
ref(obj2).__where__ = deref(w);
|
stead.ref(obj2).__where__ = stead.deref(w);
|
||||||
else
|
else
|
||||||
place(obj2, from);
|
place(obj2, from);
|
||||||
end
|
end
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if not isObject(o) then
|
if not isObject(o) then
|
||||||
o = ref(obj);
|
o = stead.ref(obj);
|
||||||
end
|
end
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o.__where__ = nil;
|
o.__where__ = nil;
|
||||||
|
@ -2525,10 +2527,10 @@ function seen(obj, wh)
|
||||||
if not wh then
|
if not wh then
|
||||||
wh = here();
|
wh = here();
|
||||||
else
|
else
|
||||||
wh = ref(wh);
|
wh = stead.ref(wh);
|
||||||
end
|
end
|
||||||
local o,w = wh:srch(obj);
|
local o,w = wh:srch(obj);
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
return o,w
|
return o,w
|
||||||
end
|
end
|
||||||
|
@ -2539,10 +2541,10 @@ function exist(obj, wh)
|
||||||
if not wh then
|
if not wh then
|
||||||
wh = here();
|
wh = here();
|
||||||
else
|
else
|
||||||
wh = ref(wh);
|
wh = stead.ref(wh);
|
||||||
end
|
end
|
||||||
local o,w = wh:srch(obj, true);
|
local o,w = wh:srch(obj, true);
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
return o,w
|
return o,w
|
||||||
end
|
end
|
||||||
|
@ -2551,7 +2553,7 @@ end
|
||||||
|
|
||||||
function have(obj)
|
function have(obj)
|
||||||
local o = inv():srch(obj);
|
local o = inv():srch(obj);
|
||||||
o = ref(o);
|
o = stead.ref(o);
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
return o
|
return o
|
||||||
end
|
end
|
||||||
|
@ -2561,7 +2563,7 @@ end
|
||||||
function moveto(obj, there, from, pos)
|
function moveto(obj, there, from, pos)
|
||||||
remove(obj, from);
|
remove(obj, from);
|
||||||
putto(obj, there, pos);
|
putto(obj, there, pos);
|
||||||
return ref(obj);
|
return stead.ref(obj);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -2719,20 +2721,20 @@ end
|
||||||
stead.set_sound = set_sound
|
stead.set_sound = set_sound
|
||||||
|
|
||||||
function change_pl(p)
|
function change_pl(p)
|
||||||
local o = ref(p);
|
local o = stead.ref(p);
|
||||||
if type(deref(p)) ~= 'string' or not o then
|
if type(stead.deref(p)) ~= 'string' or not o then
|
||||||
error ("Wrong player name in change_pl...", 2);
|
error ("Wrong player name in change_pl...", 2);
|
||||||
end
|
end
|
||||||
game.pl = deref(p);
|
game.pl = stead.deref(p);
|
||||||
return goto(o.where);
|
return goto(o.where);
|
||||||
end
|
end
|
||||||
|
|
||||||
function disabled(o)
|
function disabled(o)
|
||||||
return isDisabled(ref(o))
|
return isDisabled(stead.ref(o))
|
||||||
end
|
end
|
||||||
|
|
||||||
function disable(o)
|
function disable(o)
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o:disable()
|
o:disable()
|
||||||
end
|
end
|
||||||
|
@ -2740,7 +2742,7 @@ function disable(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function enable(o)
|
function enable(o)
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
if isObject(o) then
|
if isObject(o) then
|
||||||
o:enable()
|
o:enable()
|
||||||
end
|
end
|
||||||
|
@ -2748,7 +2750,7 @@ function enable(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function disable_all(o)
|
function disable_all(o)
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
if isObject(o) or isList(o) then
|
if isObject(o) or isList(o) then
|
||||||
o:disable_all()
|
o:disable_all()
|
||||||
end
|
end
|
||||||
|
@ -2756,7 +2758,7 @@ function disable_all(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
function enable_all(o)
|
function enable_all(o)
|
||||||
o = ref(o)
|
o = stead.ref(o)
|
||||||
if isObject(o) or isList(o) then
|
if isObject(o) or isList(o) then
|
||||||
o:enable_all()
|
o:enable_all()
|
||||||
end
|
end
|
||||||
|
@ -2880,10 +2882,10 @@ stead.objects = function(s)
|
||||||
allocator = obj {
|
allocator = obj {
|
||||||
nam = 'allocator',
|
nam = 'allocator',
|
||||||
get = function(s, n, c)
|
get = function(s, n, c)
|
||||||
if isObject(ref(n)) and stead.api_version >= "1.3.0" then -- static?
|
if isObject(stead.ref(n)) and stead.api_version >= "1.3.0" then -- static?
|
||||||
return ref(n);
|
return stead.ref(n);
|
||||||
end
|
end
|
||||||
local v = ref(c);
|
local v = stead.ref(c);
|
||||||
if not v then
|
if not v then
|
||||||
error ("Null object in allocator: "..tostring(c));
|
error ("Null object in allocator: "..tostring(c));
|
||||||
end
|
end
|
||||||
|
@ -2893,7 +2895,7 @@ stead.objects = function(s)
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
delete = function(s, w)
|
delete = function(s, w)
|
||||||
w = ref(w);
|
w = stead.ref(w);
|
||||||
if type(w.key_name) ~= 'string' then
|
if type(w.key_name) ~= 'string' then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -2903,7 +2905,7 @@ stead.objects = function(s)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
new = function(s, n, key)
|
new = function(s, n, key)
|
||||||
local v = ref(n);
|
local v = stead.ref(n);
|
||||||
if type(v) ~= 'table' or type(n) ~= 'string' then
|
if type(v) ~= 'table' or type(n) ~= 'string' then
|
||||||
error ("Error in new.", 2);
|
error ("Error in new.", 2);
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ __do_xact = function(str, self)
|
||||||
else
|
else
|
||||||
oo = objs():srch(o)
|
oo = objs():srch(o)
|
||||||
if not oo then
|
if not oo then
|
||||||
oo = ref(o, true)
|
oo = stead.ref(o, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif isObject(self) then
|
elseif isObject(self) then
|
||||||
|
@ -72,7 +72,7 @@ __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, ref(oo, true), unpack(aarg));
|
return 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