lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi Sam,

2012/1/16, Sam Roberts <>:
> 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


(The curious reader can check the current implementation here: