phrase_action cleanups for future hacks

This commit is contained in:
p.kosyh 2009-11-11 17:21:54 +00:00
parent 71bc74d660
commit c2b9ff972a

View file

@ -824,8 +824,8 @@ end
function phrase_action(self)
local ph = self;
local r = here();
local ret;
local r = nil;
local ret = nil;
if isDisabled(ph) then
return nil, false
end
@ -837,21 +837,26 @@ function phrase_action(self)
if f ~= nil then
ret = f();
else
error ("Error while eval phrase action");
error ("Error while eval phrase action.");
end
elseif type(ph.do_act) == 'function' then
ret = ph.do_act(self, nam);
end
local last = call(ph, 'ans');
if last == true or ret == true then
r = true;
end
if isDialog(here()) and not dialog_rescan(here()) then
ret = par(' ', ret, me():back());
end
return par("^^", last, ret);
-- if dialog_getn(self, 1) == nil then
-- me():back();
-- end
-- self._last = call(ph, 'ans');
-- return self._last;
ret = par("^^", last, ret);
if ret == nil then
return r -- hack?
end
return ret
end
function phrase_save(self, name, h, need)