Where are basic lua modules? (SOLVED)

I am trying to use flatDB as recommended in this topic Defold database and library support

But when I build I get this error : “the module ‘/string.lua’ can’t be found” in MessagePack.lua.
So I took a look at the beginning of the “MessagePack.lua” module (the flatDB dependency) and I found thoses requirements :

local char = require'string'.char
local format = require'string'.format
local floor = require'math'.floor
local tointeger = require'math'.tointeger or floor
local frexp = require'math'.frexp or require'mathx'.frexp
local ldexp = require'math'.ldexp or require'mathx'.ldexp
local huge = require'math'.huge
local tconcat = require'table'.concat

If I delete the two ‘require’string’char’ lines I get the same error with ‘math’ can’t be found.

On the MessagePack’s page they mention that “It’s a pure Lua implementation, without dependency.” So I guess that those requirement are supposed to be found directly in the Defold project, so I tried to search in my builtin folder, then on the internet but there is nothing about those basic lua modules.

Do someone know anything about this ?
Thank’s for reading :slight_smile:

1 Like

You should not require string, math or table. They have already been made available by the Defold runtime.

Instead, rewrite as:

local char = string.char
local format = string.format
...
4 Likes

It works ! Thank you :smiley:

1 Like