lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks for the help.


Jonathan Goble wrote
> Instead of trying to compile Lua the hard way, try the WinLua
> distributions. This is Lua (and LuaRocks, IIRC) pre-compiled in a sensible
> way for Windows. Trying to do it on your own is like reinventing the
> wheel. :-)

The Lua site doesn't seem to mention  WinLua <https://github.com/WinLua>  .
I'll take a look.

As for compiling Lua, installing LuaRocks, and downloading+loading a Lua
module, this worked:
1. Start a Mingw shell: C:\MinGW\msys\1.0\msys.bat
2. Cd to where the Lua source code lives, eg. cd /c/temp/lua/Lua.5.3.5.src
3. make mingw
4. make install INSTALL_TOP=c:/lua/5.3 TO_BIN="lua.exe luac.exe lua53.dll"
5. Close the Mingw shell, and open a DOS (cmd.exe) box
6. Cd where the LuaRocks source code lives, eg. cd
/c/Temp/Lua/temp/luarocks-3.3.1-win32/
7. install.bat /F /MW /LV 5.3 /LUA c:\lua\5.3
8. Edit Windows' SYSTEM and USER env't variables as shown by LuaRocks
9. To check that LuaRocks works, in a DOS box, run eg. "luarocks install
dkjson"
10. Finally, launch Lua and load the module with "local json = require
("dkjson")"

Note: It looks like Lua ignores the SYSTEM %LUA_PATH%, and only read the
USER %LUA_PATH%, leading to this:
==========
stdin:1: module 'dkjson' not found:
        no field package.preload['dkjson']
        no file
'C:\Users\fred\AppData\Roaming\LuaRocks\share\lua\5.1\dkjson.lua'
        no file
'C:\Users\fred\AppData\Roaming\LuaRocks\share\lua\5.1\dkjson\init.lua'
        no file
'C:\Users\fred\AppData\Roaming\LuaRocks\lib\lua\5.1\dkjson.dll'
        no file 'c:\lua\5.3\\lib\lua\5.3\dkjson.dll'
==========

So edit the USER %LUA_PATH% to include
"c:\lua\5.3\share\lua\5.3\?.lua;c:\lua\5.3\\share\lua\5.3\?\init.lua"

Regardless of this issue, I'm surprised the LuaRocks installer doesn't take
care of updating Windows' user env't itself.

Too bad Lua needs LuaRocks and a C compiler: At first sight, it looked lean
and mean compared to Python… until I learned that bare Lua can't do much out
of the box :-/



--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html