Code: Select all
local value = global.value
Code: Select all
local value = settings.global['value_name'].value
Code: Select all
local value = global.value
Code: Select all
local value = settings.global['value_name'].value
You should cache the settings table inside the event you use it in. Accessing it is relatively expensive (about as expensive as accessing game.*prototypes[...]), so when accessing it mutliple times within the same event, you should set a local variable to it (within the event) to improve performance.
Code: Select all
function on_runtime_mod_setting_changed (event)
local setting_name = event.setting
global.mod_settings[setting_name] = settings.global[setting_name]
end
I would discourage putting anything extra in global that you don't need to for the sole reason that it increases save file sizes and can make saving take longer.
It says "relatively expensive" and gives advice that is good for any long table access path. That's not the same as "MUCH slower".