one big question about modular files lua...
I have some files:
--------------------
config.lua
--------------------
local module = {}
module.UN = 'user'
module.PS = 'pass'
local function doSomething()
return 'a'
end
return module
---------------------
------------------------------------
app.lua
------------------------------------
local module = {}
a = config.doSomething()
myUser = config.UN
myPass = config.PS
return module
------------------------------------
-------------------------------
init.lua
-------------------------------
config = require("config")
app = require("application")
-------------------------------
what does local module = {} in all scripts mean, is this all together in one big module scope?
My app.lua must have some application logic. config.lua is some configuration variable and init.lua is startup script.
Is this ok to have in init? what this mean, will app and config have own thread and is this correct that app does not need to have call config = require("config") again when init is calling it? I am confused. Can somebody explain how this modular lua works doing application within modules?
If I do use "require" with some others scripts that does some other part of aplication functionality will those scripts do their "homework" in parallel with app.lua?
Thanx