franko / gsl-shell

GSL library shell based on LuaJIT2
http://franko.github.io/gsl-shell/
GNU General Public License v3.0
92 stars 12 forks source link

How can be used as ordinary lua module? #1

Closed sonoro1234 closed 11 years ago

sonoro1234 commented 11 years ago

I dont know where to ask so I do it here. Can be gsl-shell used as ordinary lua module? How?

franko commented 11 years ago

Hi,

GSL Shell cannot be used as a Lua module. It is actually impossible to use it with PUC-Rio Lua because it does require the FFI module available only with LuaJIT2.

Currently is not even possible to use it as a LuaJIT2 module because of some rather technical reasons related to the garbage collection and the fact that the plot windows are managed in a separate threads.

In addition I would like to add that GSL Shell is not just a module but at least three:

In the future it could be possible to create some LuaJIT2 modules from gsl shell but only if there is a strong interest. May be it could be useful that you explain why you prefere to use luajit2 with a gsl-shell module instead of simply using gsl shell.

sonoro1234 commented 11 years ago

It would allow to use gsl from any lua program or lua framework. I have some lua modules for polynomial operations( in pure lua) and I can show graphs with wxlua and also run lualanes for some realtime tasks and for lua-debuging. As GSL shell is now I guess I will only be able to use my "pure lua" modules from GSL-shell ( pehaps also require some lua-C modules) and the serialize my results to a file for using the results of calculations in my lua program.

franko commented 11 years ago

So if I understand correctly you are using the PUA-Rio Lua implementation.

As I said before gsl shell needs LuaJIT2 to work.

From the other side, in principle, you should be able to load with gsl shell any LuaJIT2 module. This means that if you have a wxlua module for LuaJIT2 it will works as well with gsl shell. The only caveat is the different search path for the packages but gsl shell can be compiled to use the standard search path.

From the practical point of view I've never tested this kind of approach. In any case I understand your request but unfortunately the current plans for GSL Shell are not to implement pure Lua modules.

I was willing to understand more your use case so thank you for the informations. If you manage to use gsl shell in some useful way for your purposes let me know :-)

Best regards, Francesco

greatwolf commented 10 years ago

Was wondering, have you looked at https://github.com/jmckaskill/luaffi? The project description claims to be compatible w/ luajit FFI interface so I'm wondering if this could allow gsl-shell to be used in standard PUC-Rio Lua.

Note that I use LuaJIT2 as my primary lua implementation so this is really more of a curiosity question on whether it's possible rather than a use-case support request.

franko commented 10 years ago

@greatwolf Hi, I was already aware of this project as it was announced in the Lua mailing list. It could be interesting but need to be tested since it is not 100% compatible with LuaJIT's FFI. Personally I'm not really interested to post the GSL bindings to pure Lua. The big plus of GSL shell is when it run on top of LuaJIT.