We are all eagerly awaiting the arrival of native extensions, but there is still some room for hacking using LuaJit FFI in the mean time, at least on desktop.
While working on a pet project I needed access to “Save/Open file”-dialogs, something currently not exposed in the Defold API. This prompted me to hack together a dumb little library called;
Important: It uses the FFI module in LuaJit, thus not available on all platforms. Currently only Windows (32bit) and OSX works.
Currently you need to copy the
native_libsfolder supplied in the library to the root of your project. (I’m trying to figure out ways to skip this…)
In one of your scripts, add;
local dialogs = require "dialogs/dialogs".
When you want to show a dialog, call:
- “Open file”-dialog:
- “Save file”-dialog: