What is the model and Packages? (module(…, package.seeall))
How can i create my own model. One more thing which i cannot understand is g:functionname()
What is the g exactly and how can i create my own properties?
function g:evenname( event )
– body
end [import]uid: 11038 topic_id: 3828 reply_id: 303828[/import]
if you read through the code then g is the display group created when the newAnim function is called and returned from the module at the end
[lua]function newAnim (imageTable)
– Set up graphics
local g = display.newGroup()
…
– Return instance of anim
return g
end[/lua]
g:someFunc(whatever) is the equivalent of g.someFunc(self, whatever)
it takes a while to understand and there are different ways of doing things, even in the supplied examples. Some contain functions within functions (eg movieclip.lua) whereas some are defined against the “class” object (facebook.lua)
the best thing you can do is study the modules and the way they are called from main.lua