[JW Lua] JW Lua constant namespaces

Thomas Weber thomas.weber at notengrafik.com
Thu Sep 3 22:35:14 CEST 2015


Thanks for that!

Why not make it a module?  Attached is module const.lua (adapted from your code with additional INVERSE namespaces to retrieve the constant names from keys) and example const_example.lua.  I put the module into a folder called "lib" where I store my modules, therefore the "lib." prefix in the latter file.

One thing made me curious:  Your iteration over the "finale" table where you check for keys starting with "__propget" seems to suggest you might add more such keys in the future - as currently (at least in JW Lua .39) there's only one such key.  What's behind this?

Thomas Weber


Am 03.09.2015 um 18:12 schrieb Jari Williamsson:
> Hello All!
>
> Attached is a script that converts the JW Lua constant names into namespaces (based on Thomas' suggestion regarding more Lua-like constant handling). For example, all NOTE_* constants become a NOTE namespace containing all the subconstants. The standard JW Lua constants are not deleted.
>
> Try it out.
>
>
> Best regards,
>
> Jari Williamsson
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: const.lua
Type: text/x-lua
Size: 900 bytes
Desc: const.lua
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150903/0bd1bb6a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: const_example.lua
Type: text/x-lua
Size: 100 bytes
Desc: const_example.lua
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20150903/0bd1bb6a/attachment-0001.bin>


More information about the JWLua mailing list