I try to make a new mod and for this mod I need to access a global variable, but every time I try to access this variablr I´ll get this error message: attempt to index global 'glob' (a nil value)
Here is the code:
Code: Select all
require "util"
require "defines"
script.on_load(function()
if glob.available ==nil then
glob.available={false,true}
end
end)
script.on_event(defines.events.on_built_entity, function(event)
local created_entity = event.created_entity
if created_entity.name == "my_entity" then
glob.available[created_entity.backer_name]=true
end
end)