Jump to content
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

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...