Hey Corona Community,
I’ve been a Lua user for about a year now and I truly love the language but, as a professional ActipScript and JavaScript developer I too wish it were a little easier to ‘type’ tables and extend those types much like JavaScripts prototypes and ActionScript classes offer. So, I decided to experiment by implementing a prototypal API for Lua.
This API follows the preferred module design pattern and anyone who knows a bit about JavaScript constructors and prototypes will be able to create ‘typed’ tables in no time.
Take a look at it in use: https://github.com/dschnare/Proto-Lua/blob/master/src/example.lua
Here’s the source for those who just want to know how it works: https://github.com/dschnare/Proto-Lua/blob/master/src/proto.lua
The source file is fully documented and also contains a few other functions you can take advantage of mixin/adheresTo/instanceof and the is__ functions.
It’s opensource so download it, use it, fork it, let me know if you like it or don’t like it.
If you come from a JavaScript background you might find my Purejs API a useful starting ground since Proto-Lua was inspired by the Purejs API. [import]uid: 111848 topic_id: 19292 reply_id: 319292[/import]