Page 1 of 2

Problem Using LuaRocks

Posted: Wed Oct 12, 2016 2:40 am
by bonez001
Hello everyone. I am trying to use LuaRocks. I am using lua5.1. I just click the install.bat after downloading the win file. When I run luarocks in cmd, it says "The system cannot find specified path." I already added the path in the Enviroment Variables where you can find luarocks.bat. What do you think is wrong? I need your help.

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 3:04 am
by Positive07
Since debugging this kind of errors is hard, could you please post an screenshot?

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 3:25 am
by bonez001
love2d.png
love2d.png (7.64 KiB) Viewed 7916 times
DO you think it has something to do with the config.-5.1.lua? Note that it initially says config.-5.3.lua. I just change the name.

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 3:51 am
by bonez001
This is what is inside config-5.1.lua

rocks_trees = {
{ name = [[user]],
root = home..[[C:\Program Files (x86)\LuaRocks]],
},
{ name = [[system]],
root = [[C:\gcc-lua-install\lua\lua-5.1]],
},
}
variables = {
MSVCRT = 'MSVCRT',
LUALIB = 'lua51.lib'
}
verbose = false -- set to 'true' to enable verbose output

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 6:24 am
by Positive07
Yeah, you'll probably need to build LuaRocks again, it has been built against Lua 5.3 and you try to run it with a different version (5.1) so it may not run at all.

In another note, luarocks (C:\ProgramFiles x86\LuaRocks) and lua5.1 (C:\gcc-lua-install\lua\lua-5.1 I guess?) need to be in your PATH environment variable.

Also I have never configured luarocks myself but I think it expects to find a few environment variables like LUAINC, LUALIB and whatnot. It should have a tutorial to manually install somewhere though

PS: If you built with MinGW the dll generated for LuaJIT may not be compatible with MSVC built LuaJIT dll (such as the one in LÖVE), I may be wrong but I heard about this a couple of times so I always build with the Community Version of Visual Studio 2013 which is free. Also the dll should have the same name as LÖVE's (lua51.dll) so if you used a different name (lua-5.1.dll, lua-51.dll, lua5.1.dll) it won't find it when you use the dll with LÖVE... yeah this is not easy, so if you did all that then you may be good.

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 6:50 am
by bonez001
Thanks. I just forgot to add all paths. It is working now but I have another error installing luasql:


LNK1181:cannot open input file 'mysqlclient.lib'

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 9:10 am
by Positive07
I suggest you move everything in the "C:\Program Files\MySQL\MySQL Connector\include" and "C:\Program Files\MySQL\MySQL Connector\lib" to a path with no spaces like "C:\MySQL\include" and "C:\MySQL\lib" because the problem may be that the quotes are discarded and your path contains spaces so the linker can't handle those paths... For more information on the issue check support from Microsoft

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 10:51 am
by bonez001
Hello thanks for the reply. I finally installed (I think) luasql-mysql but I have some trouble loading it. When I run in CMD the following codes:

local mysql = require("luasql-mysql")

the console says module not found. It seems the only thing that installation gave is mysql.dll. I cannot find any luasql.lua or luasql.mysql LUA file in my computer.

Below are the images


Hope someone can help me. It seems I am near completing it.

Re: Problem Using LuaRocks

Posted: Wed Oct 12, 2016 1:58 pm
by Zireael
'luasql-mysql' is the rock name. The dll names are not necessarily identical.

Try requiring require("mysql") instead to see if it finds the dll.

When I had similar problems, I moved the dlls to one of the folders listed in the error message and it worked.

Re: Problem Using LuaRocks

Posted: Thu Oct 13, 2016 5:35 am
by bonez001
Hello. Thanks for the reply. I try putting the dll file but I got the following error: