i'm new in this community - and board search didn't come up with a result for such a problem - but i got some issue with a mod i try to get up and running - i got some issues placing a modded entity and getting this error:
here is the content of my control.lua - if i got the error right the origin of the error should be around line 10 and it seems to expect a kind of index or a integer not given. could not find out which one at the moment.Error while running event on_built_entity(ID6) __TESTMOD__/control.lua:10:bab argument #-1 to '__newindex'(number expected, got nil)
Code: Select all
require ("util")
script.on_event(defines.events.on_built_entity, function(event)
if event.created_entity.name == "windtrap_mk1" then
local windtrap_mk1 = event.created_entity
if global.windtrap_mk1 == nil
then global.windtrap_mk1 = {}
end
table.insert(global.windtrap_mk1, windtrap_mk1)
windtrap_mk1.fluidbox[1] = {type="wind", ammount=100, temperature=40}
end
end)
script.on_event(defines.events.on_tick, function(event)
if (game.tick % 25000) == 0 then
global.temperature = math.random(0,40)
game.player.gui.top.add{type="label",name="Info", caption=global.temperature}
end
update_windtraps()
end)
function update_windtraps()
if global.windtrap_mk1 ~= nil then
for index, windtrap in pairs (global.windtrap_mk1) do
if windtrap.fluidbox[1] ~= nil then
local x = windtrap.fluidbox[1]
x["ammount"] = 100
x["temperature"] = global.temperature
windtrap.fluidbox = x
else table.remove(global.windtrap_mk1, index)
end
end
end
end
thanks and regards
archdruid

