While requiring files using relative paths I came accross a bug in my code however I found the cause to be because of lua's package cache; you may already know but require stores required files so that when the file is required again it returns the same table. The error I found was that with relative paths it treated each one as its own package (seen below using log). If this is just something that lua does then im sorry to bother you with this.
Example:
Code: Select all
File Structure
> Mod Root
-> expcore
->-> gui.lua
->-> gui
->->-> left.lua (this file is for left frames)
->->-> toolbar.lua (this file is for top button flow)
Code: Select all
Requires
#gui.lua
require './gui/toolbar'
require './gui/left'
#left.lua
require './toolbar'
#toolbar.lua
log('added button')
Again just want to say this might not be a bug and may just be how lua works but due to the altered require function I cant be certain that it is just a lua thing.