From 6006dc933f5f4c655dc14324fd9b596de1290bc7 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Sun, 27 Jun 2010 09:43:18 +0000
Subject: [PATCH] goodby xobj
---
stead/Makefile.windows | 2 +-
stead/xact.lua | 26 +++++++++++++++++---------
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/stead/Makefile.windows b/stead/Makefile.windows
index e1b8acf..d655a97 100644
--- a/stead/Makefile.windows
+++ b/stead/Makefile.windows
@@ -6,7 +6,7 @@ install:
copy stead.lua ..\bin\stead
copy gui.lua ..\bin\stead
copy goto.lua ..\bin\stead
- copy xobj.lua ..\bin\stead
+ copy xact.lua ..\bin\stead
copy input.lua ..\bin\stead
copy click.lua ..\bin\stead
copy dbg.lua ..\bin\stead
diff --git a/stead/xact.lua b/stead/xact.lua
index e24c363..8db161c 100644
--- a/stead/xact.lua
+++ b/stead/xact.lua
@@ -21,7 +21,7 @@ xact = function(n, f) -- just simple action!
return v
end
-__do_xact = function(str)
+__do_xact = function(str, self)
local aarg = {}
local function parg(v)
stead.table.insert(aarg, v);
@@ -29,7 +29,7 @@ __do_xact = function(str)
end
local xrefrep = function(str)
local s = stead.string.gsub(str,'[{}]','');
- local o,d, a;
+ local o,d,a, oo;
local i = s:find(":", 1, true);
aarg = {}
if i then
@@ -42,15 +42,23 @@ __do_xact = function(str)
a:gsub('[^,()]+', parg);
end
if o == '' then
- error("Empty link: "..s, 3);
+ if isObject(self) then
+ oo = self
+ else
+ error("Empty link: "..s, 3);
+ end
+ else
+ oo = objs():srch(o)
+ if not oo then
+ oo = ref(o)
+ end
end
+ elseif isObject(self) then
+ oo = self
+ d = s;
else
error("Wrong link: "..s, 3);
end
- local oo = objs():srch(o)
- if not oo then
- oo = ref(o)
- end
return xref(d, ref(oo), unpack(aarg));
end
if type(str) ~= 'string' then return end
@@ -66,9 +74,9 @@ stead.fmt = stead.hook(stead.fmt, function(f, ...)
return r;
end)
-xobj = stead.inherit(obj, function(v)
+obj = stead.inherit(obj, function(v)
v.xref = function(s, str)
- return str
+ return __do_xact(str, s);
end
return v
end)