Page 1 of 1

global variable returns nil

Posted: Sun Jun 05, 2016 2:07 pm
by derbobo
Hello
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)
Sry for bad english :/

Re: global variable returns nil

Posted: Sun Jun 05, 2016 2:14 pm
by Rseding91
"glob" went away with 0.12. It's "global" now.