Lua Modules
How to create and use Lua modules.
local M = {}
return Mlocal mymodule = require("mymodule")local mymodule = require("utils.mymodule")local M = {}
M.secret = 777
-- you can get and set the M.secret value outside of the module
function M.hello_world()
print("Hello World Defold!")
end
-- you could call M.hello_world() here once too
-- if you wanted any function to be called once for your module
-- such as an init function which checks to see if it
-- has already been initialized or not
-- you can also define local functions here
-- local functions in a module are private to that module
return MLast updated