From c4ce8587b6ff2e7f117c80fc905472583bc3f441 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Tue, 27 Oct 2009 15:07:42 +0000
Subject: [PATCH] cleanups, cctx
---
stead/stead.lua | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/stead/stead.lua b/stead/stead.lua
index caf1a37..14a73b6 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -8,6 +8,10 @@ stead = {
cctx = { txt = nil, self = nil },
}
+function cctx()
+ return stead.cctx[stead.call_top];
+end
+
function callpush()
stead.call_top = stead.call_top + 1;
stead.cctx[stead.call_top] = { txt = nil, self = nil };
@@ -23,30 +27,30 @@ end
function self(v)
if v ~= nil then
- stead.cctx[stead.call_top].self = v;
+ cctx().self = v;
end
- return stead.cctx[stead.call_top].self;
+ return cctx().self;
end
function pclr()
- stead.cctx[stead.call_top].txt = nil
+ cctx().txt = nil
end
function pget()
- return stead.cctx[stead.call_top].txt;
+ return cctx().txt;
end
function p(...)
local i
for i = 1, stead.table.maxn(arg) do
- stead.cctx[stead.call_top].txt = par('',stead.cctx[stead.call_top].txt, arg[i]);
+ cctx().txt = par('',cctx().txt, arg[i]);
end
- stead.cctx[stead.call_top].txt = cat(stead.cctx[stead.call_top].txt, ' ');
+ cctx().txt = cat(cctx().txt, ' ');
end
function pn(...)
p(unpack(arg));
- stead.cctx[stead.call_top].txt = par('',stead.cctx[stead.call_top].txt,'^');
+ cctx().txt = par('',cctx().txt,'^');
end
-- merge strings with "space" as separator