goodby xobj
This commit is contained in:
parent
ec21a2df10
commit
6006dc933f
|
@ -6,7 +6,7 @@ install:
|
||||||
copy stead.lua ..\bin\stead
|
copy stead.lua ..\bin\stead
|
||||||
copy gui.lua ..\bin\stead
|
copy gui.lua ..\bin\stead
|
||||||
copy goto.lua ..\bin\stead
|
copy goto.lua ..\bin\stead
|
||||||
copy xobj.lua ..\bin\stead
|
copy xact.lua ..\bin\stead
|
||||||
copy input.lua ..\bin\stead
|
copy input.lua ..\bin\stead
|
||||||
copy click.lua ..\bin\stead
|
copy click.lua ..\bin\stead
|
||||||
copy dbg.lua ..\bin\stead
|
copy dbg.lua ..\bin\stead
|
||||||
|
|
|
@ -21,7 +21,7 @@ xact = function(n, f) -- just simple action!
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
|
|
||||||
__do_xact = function(str)
|
__do_xact = function(str, self)
|
||||||
local aarg = {}
|
local aarg = {}
|
||||||
local function parg(v)
|
local function parg(v)
|
||||||
stead.table.insert(aarg, v);
|
stead.table.insert(aarg, v);
|
||||||
|
@ -29,7 +29,7 @@ __do_xact = function(str)
|
||||||
end
|
end
|
||||||
local xrefrep = function(str)
|
local xrefrep = function(str)
|
||||||
local s = stead.string.gsub(str,'[{}]','');
|
local s = stead.string.gsub(str,'[{}]','');
|
||||||
local o,d, a;
|
local o,d,a, oo;
|
||||||
local i = s:find(":", 1, true);
|
local i = s:find(":", 1, true);
|
||||||
aarg = {}
|
aarg = {}
|
||||||
if i then
|
if i then
|
||||||
|
@ -42,15 +42,23 @@ __do_xact = function(str)
|
||||||
a:gsub('[^,()]+', parg);
|
a:gsub('[^,()]+', parg);
|
||||||
end
|
end
|
||||||
if o == '' then
|
if o == '' then
|
||||||
|
if isObject(self) then
|
||||||
|
oo = self
|
||||||
|
else
|
||||||
error("Empty link: "..s, 3);
|
error("Empty link: "..s, 3);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
error("Wrong link: "..s, 3);
|
oo = objs():srch(o)
|
||||||
end
|
|
||||||
local oo = objs():srch(o)
|
|
||||||
if not oo then
|
if not oo then
|
||||||
oo = ref(o)
|
oo = ref(o)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
elseif isObject(self) then
|
||||||
|
oo = self
|
||||||
|
d = s;
|
||||||
|
else
|
||||||
|
error("Wrong link: "..s, 3);
|
||||||
|
end
|
||||||
return xref(d, ref(oo), unpack(aarg));
|
return xref(d, ref(oo), unpack(aarg));
|
||||||
end
|
end
|
||||||
if type(str) ~= 'string' then return end
|
if type(str) ~= 'string' then return end
|
||||||
|
@ -66,9 +74,9 @@ stead.fmt = stead.hook(stead.fmt, function(f, ...)
|
||||||
return r;
|
return r;
|
||||||
end)
|
end)
|
||||||
|
|
||||||
xobj = stead.inherit(obj, function(v)
|
obj = stead.inherit(obj, function(v)
|
||||||
v.xref = function(s, str)
|
v.xref = function(s, str)
|
||||||
return str
|
return __do_xact(str, s);
|
||||||
end
|
end
|
||||||
return v
|
return v
|
||||||
end)
|
end)
|
||||||
|
|
Reference in a new issue