Hello, Good Morning~~
I am currently working on an RPG game, and I am looking into using Defold for it, so far, it has attended to my necessities very well, however, I am finding myself in need of a database to use with it (doesn’t need to be SQL, but I would be happy if it is)
I have found many Lua Database Bindings that use C_LIB, which according to some posts here, can’t be used inside defold…
I have also found a couple that do not use C_LIB but use the LuaJIT’s FFI, and I would like to know how does the engine support that function of the LuaJIT and if I can use such libraries (I have seen posts saying it uses LuaJIT as well);
Finally. if anyone has any suggestion of a pure lua database library or similar, I would be happy to hear it
Also, XML and JSON are out of scope for doing this component of the game, just in case anyone had that idea XD
Annnnd after more googling and testing~~ (I know its not big deal, but i wanted to share, cause nobody here shares anything about databases it seems )
if anyone is interested in using a database, I have found this little performatic database called FlatDB, its written in Lua, pure implementation, very easy to add to your Defold project, sadly, its noSQL, however its very easy and straightfoward to use
here is the github link: (just add the flatdb.lua file from the source to your project)
https://github.com/uleelx/FlatDB
it deppends on lua-MessagePack, which you can grab here~~ (just add the MessagePack.lua file from the source (resides in the src folder in the link below) to your project)
https://github.com/fperrad/lua-MessagePack
however, there is a small modification you will need to do to use it, first, on flatdb.lua, change the line #1 to
local mp = require(“LUASCRIPTSLOCATION.MessagePack”)
where,
-LUASCRIPTSLOCATION is the folder where your scripts reside in your project (NOTICE THE PERIOD BEFORE MessagePack)~~ (for example, mine are in the main folder, soo…main.MessagePack, YOU MUST ADD THIS EVEN IF THE FILE IS IN THE SAME FOLDER)
lastly, whenever you want to open a database, you should use:
local flatdb = require(“LUASCRIPTSLOCATION.flatdb”)
flatdb(“DATABASELOCATION/db”)
where:
-LUASCRIPTSLOCATION is your scripts location like mentioned above~~
-DATABASELOCATION is where the database resides in your project resource directory tree~~
Have fun building stuffs with FlatDB and Defold