Hi,
I am working on a project with the composer and am trying to make globally accessible color tables. My game has multiple themes, and I would like to keep all of the themes organized in one external lua file. This way, every scene has access to the different color tables (which are changed depending on which theme the player has picked).
I have the module loading properly into each scene, but my only problem is in creating multiple tables/functions within each module.
Here’s what I have:
All scene files import scene.functions.themes:
local color\_palettes = require( "scene.function.themes" ) package.loaded["scene.function.themes"]
My scene.functions.themes (there will be more themes, but I cut it down to two for sake of this thread)
local palette\_1 = { [1] = "0", [2] = "0", [3] = "1", } return palette\_1 local palette\_2 = { [1] = "1", [2] = "1", [3] = "1", } return palette\_2
Once loading in the module, I receive the following error:
error loading module 'scene.functions.themes' from file '/Users/admin/Documents/theme-test/scene/functions/themes.lua': /Users/admin/Documents/theme-test/scene/functions/themes:3: '\<eof\>' expected near 'local' stack traceback: [C]: ? [C]: in function 'require' ?: in function 'require'
Is this a normal error in the sense that I should just create a new module file for each theme? I’d like to avoid this though, as I will have about 15 themes and would not like to load that many files into each level scene.
Thanks!