Hello all,
I have been wondering about what I would need to do to use other Lua extentions along with [lua]? Is it just a matter of compiling those linked libraries, and then doing a require "my-extention'' in the code? Does anything in the C portions of PdLua need to be recompiled?
Thanks,
Mike
Hallo, Mike McGonagle hat gesagt: // Mike McGonagle wrote:
I have been wondering about what I would need to do to use other Lua extentions along with [lua]? Is it just a matter of compiling those linked libraries, and then doing a require "my-extention'' in the code? Does anything in the C portions of PdLua need to be recompiled?
Lua itself can be compiled with or without the capabilty to load other modules. Generally it is compiled with a default of enabling modules, so you will be fine.
Other than that it's only a matter of letting pdlua find the modules. It's fine if you install your modules globally, i.e. in /usr/lib/lua. To be able to load modules in the current patch's directory, on older Pd versions some fiddling with the Lua search path may be needed (search the archives). On newer Pds (I think starting with 0.40 or 0.41) pdlua can add the current directory to the search path itself.
After all that it's indeed just a simple: require"Box2D" or so.
Frank
Hi Mike, Frank, all,
Frank Barknecht wrote:
Hallo, Mike McGonagle hat gesagt: // Mike McGonagle wrote:
I have been wondering about what I would need to do to use other Lua extentions along with [lua]? Is it just a matter of compiling those linked libraries, and then doing a require "my-extention'' in the code? Does anything in the C portions of PdLua need to be recompiled?
Lua itself can be compiled with or without the capabilty to load other modules. Generally it is compiled with a default of enabling modules, so you will be fine.
Other than that it's only a matter of letting pdlua find the modules. It's fine if you install your modules globally, i.e. in /usr/lib/lua. To be able to load modules in the current patch's directory, on older Pd versions some fiddling with the Lua search path may be needed (search the archives). On newer Pds (I think starting with 0.40 or 0.41) pdlua can add the current directory to the search path itself.
After all that it's indeed just a simple: require"Box2D" or so.
I haven't tested this in depth - so I'm not sure if it works so easily - I remember there are two search paths in Lua, one for .lua files and one for compiled files, and I can't remember right now if I added support for the compiled file path (I have a hunch that I didn't, because I wasn't sure how to get it to work cleanly with the .so vs .dll file name stuff...). I also can't remember if I added the require path hooks for plain .lua packages to both the Lua loader and the [luax] object.
So, it might require (sorry for the pun..) some fiddling to get it to work, maybe modifications/recompilation of the C part of pdlua, etc - patches welcome, but I'll get around to testing it thoroughly soon, and probably rewrite that part of the code completely (if I remember correctly I used Lua's C api when using Lua scripting would be easier to maintain...).
Expect a new release of pdlua when I'm confident that the require stuff is all working satisfactorily.
Ciao
Thanks,