Sign in to follow this  
Komat7

Calling SDKs C functions from lua script

Recommended Posts

Hello everyone interested by this developpers topic, specially LINDA's :hi:
I would like to know if it will be, or how it's, possible from LINDA lua script to call
C SDK addons functions directly by using the lua ffi library (luaJIT) ?
Maybe it's already possible with the LINDA lua editor. I'am not an expert with it. Tried but the ffi library is not loaded or not include and it's throw a nil exception.

this simple lua script works in IDE like ZeroBrane studio. It calls LevelD 767 SDK functions directly. This is really handy:

local ffi = require("ffi")
ffi.cdef
[[
long LVLDSession(int action, int version);
long SendLVLDCommand(int action, int value);
]]

name = "D:\\Program Files (x86)\\ZeroBraneStd\\myprograms\\LVLDSDK"
clib = ffi.load(name)
result = clib.LVLDSession(1, 202) -- open LVLDSDK Session
result = clib.SendLVLDCommand(32,1); -- send command OVRD LIGHT ON
result = clib.LVLDSession(0, 202) -- close LVLDSDK Session
print("LVLDSession return:" .. result)

any help appreciate

Marc

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this