[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Questions from a new Lua user...
- From: Jonathan Adamczewski <jadamcze@...>
- Date: Thu, 19 Oct 2000 01:44:34 +0000 (GMT)
On Wed, 18 Oct 2000, Eric Tetz wrote:
>
> and still being able to call it as
>
> drawtext(p:xy(),s)
>
In this case, call as
drawtext(s,p:xy())
and drawtext gets all three values. Just change the ordering of names in
the function.
> Or being able to do say something succinct like
>
> drawrect(r:bounds(),clr:rgb())
>
> instead of
>
> drawrect(r.tl.x, r.tl.y, r.br.x, r.br.y, clr.r, clr.g, clr.b).
>
Use tables? (the following stuff is very unchecked)
function bounds(a)
local t = {x=1,y=1}
local b = {x=10,y=10}
return {tl=t,br=b}
end
r = {bounds=bounds}
drawrect(r:bounds(),...) --whatever
Gives a table containing the four values to drarect.
By using tables and changing the order of arguments, I believe you can do
all the things you have mentioned.
(of coure I could have missed the point - please be gentle pointing out
mistakes... I started with lua just over a week ago :)
Jonathan.