http://luajit.org/ext_ffi.htmlThe FFI library allows calling external C functions and using C data structures from pure Lua code.
LuaJIT FFI Library (C code from LuaJIT)
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- AntonioModer
- Party member
- Posts: 202
- Joined: Fri Jun 15, 2012 5:31 pm
- Location: Belarus
- Contact:
LuaJIT FFI Library (C code from LuaJIT)
I find awesome library in LuaJIT.
- Ranguna259
- Party member
- Posts: 911
- Joined: Tue Jun 18, 2013 10:58 pm
- Location: I'm right next to you
Re: LuaJIT FFI Library (C code from LuaJIT)
Wow, can we do this in LÖVE ?
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: LuaJIT FFI Library (C code from LuaJIT)
Yes, if the build of LÖVE you're using is linked with LuaJIT instead of regular Lua. It is the default for 0.9.1, so you probably can.
Help us help you: attach a .love.
Re: LuaJIT FFI Library (C code from LuaJIT)
FYI, yes you can take advantage of LuaJIT's FFI library (thanks to LuaJIT). I was able to successfully use the clipper FFI bindings at http://luapower.com/clipper.html. Once you build the dynamic library, simply put that and your .lua file with your FFI bindings into your project like you would any other .lua file, and
Piece of cake!
Code: Select all
local clipper = require "clipper"
- AntonioModer
- Party member
- Posts: 202
- Joined: Fri Jun 15, 2012 5:31 pm
- Location: Belarus
- Contact:
- AntonioModer
- Party member
- Posts: 202
- Joined: Fri Jun 15, 2012 5:31 pm
- Location: Belarus
- Contact:
Re: LuaJIT FFI Library (C code from LuaJIT)
English.
Creating a dynamic link library and call the "native-C" function of this library from LuaJIT 2 (from LOVE2D).
Русский.
Создание динамической библиотеки и вызов "нативной-C" функции этой библиотеки из LuaJIT 2 (из LOVE2D)
Source files: https://drive.google.com/open?id=0BxsLw ... lBRWXpIb0U
Creating a dynamic link library and call the "native-C" function of this library from LuaJIT 2 (from LOVE2D).
Русский.
Создание динамической библиотеки и вызов "нативной-C" функции этой библиотеки из LuaJIT 2 (из LOVE2D)
Source files: https://drive.google.com/open?id=0BxsLw ... lBRWXpIb0U
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests