Design patterns in Lua?

I’m curious about implementing design patterns in Lua. Corona includes the Observer pattern as the Event listener system. Design patterns could be useful in many situations. For example I was just working on project using storyboard. My scenes want to get data stored in an array in main.lua. The Iterator pattern would be good for this.

I’m having trouble wrapping my head around this in Lua. I was wondering if anyone had see any information on this?

[import]uid: 122631 topic_id: 27342 reply_id: 327342[/import]

Why do you need an iterator when you can easily loop over an array? Are you trying to get access to the data by decoupling the references to the array? [import]uid: 27183 topic_id: 27342 reply_id: 111097[/import]

Programming in Lua has an entire chapter about iterators.
See Chapter 7 and also 9.3
http://www.lua.org/pil/index.html#P1
[import]uid: 7563 topic_id: 27342 reply_id: 111102[/import]