Tables from data.lua to control.lua

Place to get help with not working mods / modding interface.
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Tables from data.lua to control.lua

Post by Arch666Angel »

Is there a way to keep the tables from the data---.lua stage, that they can be used in the Control.lua stage? In my Experiments i couldnt get it to work, but since my Knowledge of such Things (coding) is limited I thought I ask if I either do it wrong, or if there is no way.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5410
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Tables from data.lua to control.lua

Post by Klonan »

If you give an example of what you're tryign to accomplish, i may be able to help you there
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: Tables from data.lua to control.lua

Post by Arch666Angel »

So I have been told that people are lazy and don't want to unpack, edit config.lua's and repack mods files to change setting. Since the game is lacking an interface to edit edit from inside the game/mods menu the simplest way I could think of was another "trigger" mod which only does enable/disable certain options of the main mod:

[quote=""trigger mod" data.lua"]
if not exoticdancers then exoticdancers = {} end
exoticdancers.over18modetrigger = true
[/quote]

[quote=""main mod" data.lua"]...
require("config")

if exoticdancers.over18modetrigger then
exoticdancers.over18mode = false
end
...
[/quote]

Then I wanted to do the same thing with a mod, that only has things happening in the control.lua and it wont work. As far as I understand the whole thing the control.lua is executed independently from the data.luas and does not have access to tables from other mods data.luas?

I new to coding and lua, so forgive my newb questions :D
Post Reply

Return to “Modding help”