LuaJit FFI and hiding C implementation details

Posted by wirrbel on Programmers See other posts from Programmers or by wirrbel
Published on 2013-07-20T16:31:38Z Indexed on 2013/10/20 22:10 UTC
Read the original article Hit count: 270

Filed under:
|
|
|

I would like to extend an application using LuaJit FFI. Having seen http://luajit.org/ext_ffi_tutorial.html this is surprisingly easy when comparing this to the Lua C API. So far so good. However I do not plainly want to wrap C functions but provide a higher level API to users writing scripts for the application. Especially I do not want users to be able to access "primitives", i.e. the ffi.* namespace. Is this possible or will that ffi namespace be available to user's Lua scripts?

On the issue of Sandboxing Lua I found http://lua-users.org/wiki/SandBoxes which is not talking about FFI though.

Furthermore, the plan I have described above is assuming that the introduction of abstraction layers happens on the lua side of code. Is this an advisable approach or would you rather abstract functionality on the statically compiled code (on the C-side)?

© Programmers or respective owner

Related posts about scripting

Related posts about lua