lua-users home
lua-l archive

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



Message: 3
Date: Thu, 16 Dec 2010 19:52:44 -0500
From: David Manura <dm.lua@math2.org>

On Thu, Dec 16, 2010 at 7:18 PM, Maxime Chupin <mc@melusine.eu.org> wrote:
> I have to invert a matrix, so I found lua-matrix
> http://lua-users.org/wiki/LuaMatrix
> So I tried luarocks install luamatrix as it is said on github
> https://github.com/davidm/lua-matrix, but it does not work. Then I have
> downloaded the files matrix.lua and complex.lua, but now, I don't know what
> is the way to add it.
> I read about LUA_PATH, but I don't know how to find where I have to put
> them. I use Debian (echo $LUA_PATH is empty).

When you do this:

 matrix = require "matrix"

if it fails, it will raise an error, and the error message will
contain a list of all file paths it searched for matrix.lua in.  So,
you just need to make sure that matrix.lua is located in one of those
paths.

Here's what that error looks like on one Linux system I have here:

stdin:1: module 'matrix' not found:
       no field package.preload['matrix']
       no file './matrix.lua'
       no file '/usr/local/share/lua/5.1/matrix.lua'
       no file '/usr/local/share/lua/5.1/matrix/init.lua'
       no file '/usr/local/lib/lua/5.1/matrix.lua'
       no file '/usr/local/lib/lua/5.1/matrix/init.lua'
       no file '/usr/share/lua/5.1/matrix.lua'
       no file '/usr/share/lua/5.1/matrix/init.lua'
       no file './matrix.so'
       no file '/usr/local/lib/lua/5.1/matrix.so'
       no file '/usr/lib/lua/5.1/matrix.so'
       no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
       [C]: in function 'require'
       stdin:1: in main chunk
       [C]: ?



Ok, thanks, I created /usr/local/share/lua/5.1/ and I put the two files in. Now it's work. But, can I define a LUA_PATH system variable in my .bashrc (for my little functions I will created) ?


--
Maxime Chupin
http://mc.notezik.com