Hello Guest it is December 08, 2019, 10:05:27 PM

Author Topic: how can i use my own lua libraries in mach 4 ?  (Read 841 times)

0 Members and 1 Guest are viewing this topic.

how can i use my own lua libraries in mach 4 ?
« on: April 23, 2018, 03:55:53 PM »
i want to use some linear algebra libraries inside of my lua scripts in MACH4.
Is this possible? if so is there a specific directory where i have to save these libraries in order for lua to import them properly.

help appreciated.
Re: how can i use my own lua libraries in mach 4 ?
« Reply #1 on: April 23, 2018, 09:13:59 PM »
Hi,
way above my paygrade...ah, hang on I don't get paid...LOL.

If I understand correctly Lua is a plugin to the core C/C++ program and thats where a library would normally be.
That would in turn require access to the plugin which is NFS property. They might be agreeable to a library addition.

Could you program (in Lua) the components/functions you want and put them in a module? Daz has done a good
video on modules in recent times.

Craig
My wife left with my best friend...
     and I miss him!
Re: how can i use my own lua libraries in mach 4 ?
« Reply #2 on: April 23, 2018, 09:30:10 PM »

yes i figured i could do that. but i was trying to avoid all the work. there are functions that reference other functions and so on...
I would have to also make those dependencies again. or just simply rewrite the functions so they fit into this ideology.

thanks for the response!
Re: how can i use my own lua libraries in mach 4 ?
« Reply #3 on: April 23, 2018, 10:29:42 PM »
Hi,
as far as I know all the standard libraries of Lua 5.2 are implemented.
Is the library you have have the same form as the standard libraries?

Craig
My wife left with my best friend...
     and I miss him!
Re: how can i use my own lua libraries in mach 4 ?
« Reply #4 on: April 23, 2018, 10:38:14 PM »
Here is a possible library i would like to use.
http://scilua.org
Re: how can i use my own lua libraries in mach 4 ?
« Reply #5 on: April 23, 2018, 11:10:00 PM »
Hi,
very kool! I'm not sure but LuaJIT is different to plain Lua.
Whether there is sufficent compatability to include it as a library in plain Lua I don't know.

How about putting LuaJIT in a module of its own? It would give you control of libraries etc without
bugging the hell out of NFS.

Craig
My wife left with my best friend...
     and I miss him!
Re: how can i use my own lua libraries in mach 4 ?
« Reply #6 on: April 24, 2018, 10:39:13 AM »
any lua/dll module/library that is located in the 'modules' directory that conforms to lua 5.2 can be loaded at run load time, see the screen load script:

--Master module
package.loaded.MasterModule = nil
mm = require "mcMasterModule"
   
--Probing module
package.loaded.Probing = nil
prb = require "mcProbing"
--mc.mcCntlSetLastError(inst, "Probe Version " .. prb.Version());

If the module extension is different than .lua then change your load path to search for that as well.

package.path = path .. "\\Profiles\\" .. profile .. "\\Modules\\?.lua;" .. path .. "\\Modules\\?.lua;"

LuaJIT is a compiler.  Mach4 runs it's own compiler to compile all lua, mcs files at each load and I don't believe you can just include the compiled module in the modules directory, but then again I haven't tried.  Good question though.

I'm not sure if the sci modules are 5.2 compatible.

MTCW

RT