[SOLVED] Is luajit table.new() function available in defold?

You can require table.new() like this:

package.preload["table.new"]()

You don’t need to use require after that anymore, just put it on the top of your script. The require that Defold uses is a bit different than standard Lua, to only include packages at runtime that it knows will be used, so unexpected modules like a Luajit extensions can require a workaround like that.

package.preload can require the following packages with that method:

ffi,
jit.profile,
jit.util,
string.buffer,
table.clear,
table.new

5 Likes