[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: NCLua canvas module implementation: Silly question
- From: Ezequiel García <elezegarcia@...>
- Date: Mon, 16 Jan 2012 17:33:09 -0300
Hi Sam,
2012/1/16, Sam Roberts <vieuxtech@gmail.com>:
>
>
> module() creates a table to be your "module", makes it the environment
> (so any "global" definitions go into it magically), and also arranges
> for _M to be defined as that table so you can access it.
This I understand.
>
> I don't think you should be calling module(), but you might be able to
> make _M "be" the base canvas, and not return anything.
>
>
Yes, module() is gone as already suggested. However,
I still can't see a clear picture of modules.
>From this thread I can conclude I have two options:
1. return the instance and save it to global env as in:
_G.canvas = base
return base
2. save it to _M and return nothing:
_M = base
Right?
(The curious reader can check the current implementation here:
https://github.com/ezequielgarcia/directfb-lua/blob/master/examples/canvas/canvas.lua)
Thanks,
Ezequiel.