[JW Lua] Modules in next beta release

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Sat Aug 2 12:08:33 CEST 2014


Hello All!

In the next beta of JW Lua, you can use external modules/libraries in JW 
Lua (much more easily than in the past). That, for example, makes it 
possible to create a library file to share with other JW Lua 
programmers. I mention it now, so you can read about the subjects 
involved in advance.

You can get some basic documentation about how to create a module in the 
old PiL book online.
http://www.lua.org/pil/contents.html#15

HOWEVER, that documentation is really old, and today most Lua 
programmers have abandoned the concept of global name declaration in 
modules. If you own the 3rd edition of the PiL book, chapter 15 is much 
more relevant and helpful.

Here's an example of a library that uses a more current non-global 
approach to modules/libraries. I also like how the developer uses some 
custom fields like _VERSION and _DESCRIPTION to add information about 
the module:
https://github.com/kikito/inspect.lua/blob/master/inspect.lua


Best regards,

Jari Williamsson





More information about the JWLua mailing list