taketo, takef

This commit is contained in:
p.kosyh 2010-06-12 09:30:24 +00:00
parent fb619ebfd2
commit 7c620c434c

View file

@ -2065,16 +2065,24 @@ function remove(obj, from)
return o
end
function take(obj, wh)
function taketo(obj, wh, pos)
local o = remove(obj, wh);
if not isObject(o) then
error "Trying to take wrong object.";
end
inv():add(obj);
inv():add(obj, pos);
o._taken = true
return o
end
function take(obj, wh)
return taketo(obj, wh);
end
function takef(obj, wh)
return taketo(obj, wh, 1);
end
function putto(obj, w, pos)
local wh
local o = ref(obj);