lua-users home
lua-l archive

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


If I got it right, I think you can also change the Canvas initialization:

-- local Canvas = {}
local Canvas = _M
...


2012/1/8 Ezequiel García <elezegarcia@gmail.com>
2012/1/8 Duncan Cross <duncan.cross@gmail.com>:
>
> Try first removing the module('canvas') line (module() is not useful
> in situations like this, where you are constructing your own object
> and returning it at the end), and then setting the global variable
> yourself at the end, e.g.:
>
> -- Create base instance
> local baseInstance = Canvas.newcanvas(otherModule:CreateSurface
> {caps='DSCAPS_PRIMARY|DSCAPS_FLIPPING'})
> _G.canvas = baseInstance
> return baseInstance
>
> -Duncan
>

Sounds like a sensible solution. Thanks.