Hi, for some reason, loading modules with pcall doesn't work from the Defold kit, although it loads fine when building from the Defold editor. Some libraries use this pattern to select between local and global dependencies by checking the status code of pcall. For instance, I had to patch the penlight library to use it with a Defold project from VSCode with the Defold kit.
Steps to reproduce:
Create a project from the Desktop game template, and add a Lua module test.lua to the main directory like:
local M = {}
function M.test()
print("Hello world")
end
return M
Try to load it from the main.script:
local status, test = pcall(require, "main.test")
assert(test ~= nil)
Hi, for some reason, loading modules with
pcall
doesn't work from the Defold kit, although it loads fine when building from the Defold editor. Some libraries use this pattern to select between local and global dependencies by checking the status code ofpcall
. For instance, I had to patch the penlight library to use it with a Defold project from VSCode with the Defold kit.Steps to reproduce:
Is it a limitation of the
bob
build tool?