Using LuaRocks

Forums: Using LuaRocks
Forum for OctaneRender Lua scripting examples, discussion and support.

Using LuaRocks

Postby stratified » Sat Jan 04, 2014 10:27 pm

stratified Sat Jan 04, 2014 10:27 pm
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Using LuaRocks

Postby grimm » Sat Jan 04, 2014 11:54 pm

grimm Sat Jan 04, 2014 11:54 pm
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"? :)
Linux Mint 19 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 440.64
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1258
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Re: Using LuaRocks

Postby stratified » Sun Jan 05, 2014 12:14 am

stratified Sun Jan 05, 2014 12:14 am
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Using LuaRocks

Postby grimm » Sun Jan 05, 2014 12:33 am

grimm Sun Jan 05, 2014 12:33 am
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
Linux Mint 19 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 440.64
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1258
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Re: Using LuaRocks

Postby Tugpsx » Sun Jan 05, 2014 12:38 am

Tugpsx Sun Jan 05, 2014 12:38 am
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.
Dell Win Vista 32 | NVIDIA Quadro NVS135M | Core2 Duo T7500 2.20GHz | 4GB
CyberPowerPC Win 7 64| NVIDIA GTX660Ti (3G) GTX480(1.5G) | 16GB
Tugpsx
Licensed Customer
Licensed Customer
 
Posts: 1072
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL

Re: Using LuaRocks

Postby stratified » Sun Jan 05, 2014 3:46 am

stratified Sun Jan 05, 2014 3:46 am
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Using LuaRocks

Postby stratified » Sun Jan 05, 2014 3:52 am

stratified Sun Jan 05, 2014 3:52 am
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Using LuaRocks

Postby grimm » Mon Jan 06, 2014 4:20 am

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

Jason
Linux Mint 19 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 440.64
User avatar
grimm
Licensed Customer
Licensed Customer
 
Posts: 1258
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Re: Using LuaRocks

Postby stratified » Mon Jan 06, 2014 5:16 am

stratified Mon Jan 06, 2014 5:16 am
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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 1 guest

Thu Aug 06, 2020 6:58 am [ UTC ]