Skip to content

Wavalab/corona-closure-module-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 

Repository files navigation

Corona Closure Module Template

A closure module for corona devs.

On extending display objects and creating instances in Corona SDK

Metatable classes are very cool, but run into trouble when trying to extend display objects. Display object references generated by metatable classes fail at simple things like positioning and colorfilling. They also lack a private state!

The functional approach to managing object creation is pure and does not limit display objects at all. However, it's call syntax is clunky as the self reference must be supplied as an argument. Also, this approach lacks a private state which is important when dealing with several instances.

That brings us to closures! Closures preserve all of the display objects functionality, while allowing you to extend, override, and build as necessary. The syntax is very similar to the Metatable method but this approach allows us to enclose each object with public and private properties!

About

A closure module for corona devs, from Wavalab.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages