cleanups in stead

This commit is contained in:
p.kosyh 2011-07-29 07:17:07 +00:00
parent 5affea737b
commit 41c5738129
2 changed files with 22 additions and 22 deletions

View file

@ -1,4 +1,4 @@
go = function (self, where, back, noenter, noexit, nodsc)
stead.go = function (self, where, back, noenter, noexit, nodsc)
local was = self.where;
local need_scene = false;
local ret
@ -106,7 +106,7 @@ go = function (self, where, back, noenter, noexit, nodsc)
end
return res;
end
stead.go = go
go = stead.go
function player_go(self, where) -- cmd iface
local w = stead.ref(self.where).way:srch(where);
@ -125,36 +125,36 @@ function player_back(self) -- deprecated
error ("Do not use me():back(). It's deprecated.", 2)
end
function back()
stead.back = function()
if isDialog(here()) and not isDialog(from()) then
return stead.goout();
end
return stead.goback();
end
stead.back = back
back = stead.back
function goback()
stead.goback = function()
return me():goto(from(), true);
end
stead.goback = goback
goback = stead.goback
function goto(what, back, noenter, noexit, nodsc, ...)
stead.goto = function(what, back, noenter, noexit, nodsc, ...)
return me():goto(what, back, noenter, noexit, nodsc, ...);
end
stead.goto = goto
goto = stead.goto
function goin(what)
stead.goin = function(what)
return me():goto(what, false, false, true);
end
stead.goin = goin
goin = stead.goin
function goout(what)
stead.goout = function(what)
if isRoom(stead.ref(what)) then
return me():goto(what, true, true, false, true);
end
return me():goto(from(), true, true, false, true);
end
stead.goout = goout
goout = stead.goout
function visited(w)
if not w then w = here() end

View file

@ -802,7 +802,7 @@ function isList(v)
return (type(v) == 'table') and (v.list_type == true)
end
function call(v, n, ...)
stead.call = function(v, n, ...)
if type(v) ~= 'table' then
error ("Call on non table object:"..n, 2);
end
@ -841,9 +841,9 @@ function call(v, n, ...)
end
error ("Method not string nor function:"..tostring(n), 2);
end
stead.call = call
call = stead.call
function call_bool(v, n, ...)
stead.call_bool = function(v, n, ...)
if type(v) ~= 'table' then
error ("Call bool on non table object:"..n, 2);
end
@ -864,9 +864,9 @@ function call_bool(v, n, ...)
end
return true; -- not nil
end
stead.call_bool = call_bool
call_bool = stead.call_bool
function call_value(v, n, ...)
stead.call_value = function(v, n, ...)
if type(v) ~= 'table' then
error ("Call value on non table object:"..n, 2);
end
@ -883,7 +883,7 @@ function call_value(v, n, ...)
stead.callpop();
return r,v;
end
stead.call_value = call_value
call_value = stead.call_value
function room_scene(self)
local v;
@ -2780,14 +2780,14 @@ function isForSave(k, v, s) -- k - key, v - value, s -- parent table
return stead.string.find(k, '_') == 1 or stead.string.match(k,'^%u')
end
function inherit(o, f)
stead.inherit = function(o, f)
return function(...)
return f(o(...))
end
end
stead.inherit = inherit
inherit = stead.inherit
function hook(o, f)
stead.hook = function(o, f)
return function(...)
local ff
if type(o) ~= 'function' then
@ -2800,7 +2800,7 @@ function hook(o, f)
return f(ff, ...)
end
end
stead.hook = hook
hook = stead.hook
function nameof(v)
if isObject(v) then