global variable returns nil

Place to get help with not working mods / modding interface.
derbobo
Manual Inserter
Manual Inserter
Posts: 3
Joined: Sun Jun 05, 2016 1:58 pm
Contact:

global variable returns nil

Post 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 :/

Rseding91
Factorio Staff
Factorio Staff
Posts: 14142
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: global variable returns nil

Post by Rseding91 »

"glob" went away with 0.12. It's "global" now.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Modding help”