Here’s how Lua’s require() function works, which should help you understand how modules such as storyboard work internally, and will hopefully answer your questions.
When you call require() in Lua, the global package.loaded table will be searched for the module you requested. If it cannot be found (e.g. it was never previously loaded), then the actual file will be loaded instead.
If the module is found in package.loaded, however, then the already-loaded module from the global package.loaded table will be returned instead.
So if you’re calling:
local storyboard = require "storyboard"[/code]At the top of several files. As long as you never did this:package.loaded["storyboard"] = nil[/code](which you probably didn't do)Then the module was only actually loaded the first time you called require(), and any subsequent times is simply creating a local reference to the already-loaded table (which existed in package.loaded).@robmiracle: You nailed it. :-)-----------------------For additional explanation, you can do the following to get a better understanding of how the module system works in Lua.module_a.lualocal t = {}print( "Module is loaded." )function t.hello() print( "Hello world" )endreturn t[/code]main.lualocal a = require "module_a"-- OUTPUT: "Module is loaded."local a_again = require "module_a"-- OUTPUT: ((nothing))a, a_again = nil, nilpackage.loaded["module_a"] = nillocal a_again = require "module_a"-- OUTPUT: "Module is loaded."a_again.hello()-- OUTPUT: "Hello world"[/code]Notice how the second time we called: require "module_a", we got nothing in the terminal? That's because the module was already loaded, so we simply got a reference to the table (returned in module_a.lua) that existed in the global package.loaded table.Once we unloaded the module from package.loaded by setting it to nil, then the next time we called require() on the module, we got the print statement again. [import]uid: 52430 topic_id: 17828 reply_id: 108326[/import]