How exactly init, update, and draw work
So basically, all the code is run across all files (in what order though? Pretty much randomly, it's weird, don't rely on one file loading before another). Init, update, and draw code aren't though, because what you are doing is literally just defining a function. That's why it's
init = function() (code) end
init (code) end
or something. Now that you defined it, in memory, your code has 3 functions stored, init, update, and draw. Once every single file is loaded, init is called. Once that is done, update is set to run 60 times per second, and draw every time the canvas is refreshed. This means that all the files will have run once init, update, and draw are called (this is why placing code outside/inside those functions can cause weird issues sometimes). Hope this helps!