putto fix

This commit is contained in:
p.kosyh 2009-10-23 09:37:37 +00:00
parent b2dd1f4d8a
commit 8625747b57
2 changed files with 10 additions and 5 deletions

2
debian/changelog vendored
View file

@ -5,7 +5,7 @@ instead (0.9.3) unstable; urgency=low
* print reregister
* deref is more clever!!! It not do duble objects now
* from() with argument
* new() (allocator object)
* new()/delete() (allocator object)
* game:ini() fix
-- Peter Kosyh <p.kosyh@gmail.com> Mon, 12 Oct 2009 11:09:19 +0400

View file

@ -1827,16 +1827,21 @@ function take(obj, wh)
end
function putto(obj, w, pos)
local wh
local o = ref(obj);
if not isObject(o) then
error "Trying to put wrong object.";
end
if not w then
here().obj:add(obj, pos);
o.__where__ = deref(here());
wh = deref(here());
w = here();
else
ref(w).obj:add(obj, pos);
o.__where__ = deref(w);
wh = deref(w);
w = ref(w);
end
w.obj:add(obj, pos);
if type(wh) == 'string' then
o.__where__ = wh;
end
return o;
end