Page 1 of 1

Using LuaRocks

PostPosted: Sat Jan 04, 2014 10:27 pm
by stratified
Hi everybody,

For those who plan to do some serious scripting in the future, it's always handy to have some libraries under your belt. Octane only provides it's own API, it doesn't have all the necessary functionality.

There's this nice ecosystem called LuaRocks (http://luarocks.org/). It provides a collection of lua libraries (called rocks) and handy tools to search, install and remove libraries. For those who code ruby or perl, it's similar to ruby gems or perl's cpan although not that extensive.

A few rocks that may prove very useful while scripting for Octane: luafilesystem, lcomplex, lmathx, lua-path and luanum.

happy hacking,
Thomas

Re: Using LuaRocks

PostPosted: Sat Jan 04, 2014 11:54 pm
by grimm
Cool, I like RubyGems and bundler so this will be very nice. I tried it out on my box running Fedora and it has path issues. I did a yum install luarocks to install it. I tried installing the rock "luafilesystem" as root (luarocks install luafilesystem) and my regular user (luarocks install luafilesystem --local) and Octane can't find either one via require. Root installs the rocks in /usr/lib/luarocks/rocks, the regular user installs to /home/{user}/.luarocks/lib/luarocks/rocks but neither paths are checked in Octane. Maybe the Fedora system luarocks is configured differently then other systems? Or is the problem that I'm running Lua 5.2 on my system?

P.S. The luarocks repository didn't have the "lfs" rock that you used in the objloader script, I'm was assuming that it is the same as "luafilesystem"? :)

Re: Using LuaRocks

PostPosted: Sun Jan 05, 2014 12:14 am
by stratified
I'm using Ubuntu 12.04 and the filesystem lib (lfs.so) is installed in /usr/local/lib/lua/5.1/lfs.so. You can edit ~/.luarocks/config.lua to modify the install location of your "rocks" tree.

This is the path that Octane searches for C modules:

Code: Select all
print(package.cpath) -> ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so


Sorry for the hassle. Nobody of the devs had real Lua experience before so we're trying to figure out what works best while we go ;)

cheers,
Thomas

Re: Using LuaRocks

PostPosted: Sun Jan 05, 2014 12:33 am
by grimm
I will try editing that file. I did find lfs.so but it's in /usr/lib/lua/5.2, my /usr/local/lib is empty.

Yep that path will not work for Fedora 20 and Lua 5.2, at least. :shock:

No problem on the hassle, I'm learning too, which is good. :D

Re: Using LuaRocks

PostPosted: Sun Jan 05, 2014 12:38 am
by Tugpsx
Thanks for the awesome resource links.
Lanes might be a good add-on since it allows for multi-threading and could be interesting for multi script calling and linking.
One problem from the recent post is its instability.

Re: Using LuaRocks

PostPosted: Sun Jan 05, 2014 3:46 am
by stratified
Tugpsx wrote:Thanks for the awesome resource links.
Lanes might be a good add-on since it allows for multi-threading and could be interesting for multi script calling and linking.
One problem from the recent post is its instability.


Yep, could be useful. But care has to be taken by the coder when using our Lua API because it's not thread-safe.

cheers,
Thomas

Re: Using LuaRocks

PostPosted: Sun Jan 05, 2014 3:52 am
by stratified
grimm wrote:I will try editing that file. I did find lfs.so but it's in /usr/lib/lua/5.2, my /usr/local/lib is empty.

Yep that path will not work for Fedora 20 and Lua 5.2, at least. :shock:

No problem on the hassle, I'm learning too, which is good. :D


Well Fedora is always bleeding edge so I'm not surprised you have Lua 5.2 installed :D Did editing config.lua work out for you?

cheers,
Thomas

Re: Using LuaRocks

PostPosted: Mon Jan 06, 2014 4:20 am
by grimm
Nope, but I'm still poking at it. :D

Jason

Re: Using LuaRocks

PostPosted: Mon Jan 06, 2014 5:16 am
by stratified
I guess it's a long and cold winter in Alaska ;)

Of course, you don't have to use these rocks. Most of these things have there own project page from where you can download them directly...

cheers,
Thomas