Moonscript CLI launch error with Lua 5.3 on OSX

270 views Asked by At

I'm on OS X 10.11.1 running the latest version of X Code. I installed Lua 5.3 today from source with no problem. Seems to work correctly. No errors installing luarocks and then using it to install moonscript. However, both moon and moonc give the following error when invoked from the command line:

$ moon
/usr/local/bin/lua: /usr/local/share/lua/5.3/alt_getopt.lua:24: attempt to call a nil value (global 'module')
stack traceback:
    /usr/local/share/lua/5.3/alt_getopt.lua:24: in main chunk
    [C]: in function 'require'
    /usr/local/lib/luarocks/rocks/moonscript/0.4.0-1/bin/moon:2: in main chunk
    [C]: in ?

Looking at alt_getopt.lua shows that it is indeed using the now-defunct 'module' keyword. The GitHub project for this module appears to be dead with no action in the past 3 years.

How should I proceed to get Moonscript working on my system?

1

There are 1 answers

2
Paul Kulchenko On BEST ANSWER

Yes, as you noted, module has been deprecated for quite a while and was only working with earlier versions because of compatibility switches.

You can comment out the line 24 in alt-getopt and add the following line to the end of the alt-getopt.lua file: return {get_opts = get_opts, get_ordered_opts = get_ordered_opts}.

This should make this module Lua 5.2/5.3 compatible (I haven't checked if there are any other compatibility issues with using Lua 5.3 though).