Using LuaRocks

Forum for OctaneRender Lua scripting examples, discussion and support.
Post Reply
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

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 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

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 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
Tugpsx
Licensed Customer
Posts: 1150
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL
Contact:

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.
Win 11 64GB | NVIDIA RTX3060 12GB
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
grimm
Licensed Customer
Posts: 1332
Joined: Wed Jan 27, 2010 8:11 pm
Location: Spokane, Washington, USA

Nope, but I'm still poking at it. :D

Jason
Linux Mint 21.3 x64 | Nvidia GTX 980 4GB (displays) RTX 2070 8GB| Intel I7 5820K 3.8 Ghz | 32Gb Memory | Nvidia Driver 535.171
User avatar
stratified
OctaneRender Team
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

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
Post Reply

Return to “Lua Scripting”