err whle rung event Workbench::on_robot_built_entity (ID 14) __Workbench__/control.lua:10: bad argument #3 of 3 to
Posted: Fri Feb 17, 2023 5:39 pm
Error while running event Workbench::on_robot_built_entity (ID 14)
__Workbench__/control.lua:10: bad argument #3 of 3 to '__index' (string expected, got nil)
code at right at the end
I'm mot interacting with my mod at that point, any ghost does it as soon as a bot try to put it.. bang crash goint to menu, i can easy try new code without restarting game wich is awesome...
i feel i had this once already but can't remember how did i fix it on another mod.. yeah, i believe is somehow connected -> viewtopic.php?f=61&t=60229&p=361702#p361702 or not..
i just figured that if i used this code instead of works fine, however i can't place ghost and proceed using bots, not a bummer but i would like both if possible.
__Workbench__/control.lua:10: bad argument #3 of 3 to '__index' (string expected, got nil)
code at right at the end
I'm mot interacting with my mod at that point, any ghost does it as soon as a bot try to put it.. bang crash goint to menu, i can easy try new code without restarting game wich is awesome...
i feel i had this once already but can't remember how did i fix it on another mod.. yeah, i believe is somehow connected -> viewtopic.php?f=61&t=60229&p=361702#p361702 or not..
Code: Select all
local debugModeForTesting = 1
local function on_built(event)
-- script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, on_built)
-- script.on_event(defines.events.on_player_mined_entity, function(event)
-- --event.buffer.remove({name="coal", amount=1})
-- end
-- )
local player = game.players[event.player_index]
if event.created_entity.name == "workbench-mk1" then
--event.created_entity.insert({name="coal", amount=1})
--ignorar por hora..mas não esquecer!
--game.surfaces[1].create_entity{name = "inserter", position = game.player.position, direction = defines.direction.north}
local entity = event.created_entity
if (entity.name == "workbench-mk1") and entity.burner and entity.burner.remaining_burning_fuel then
-- e event.created_entity.burner.currently_burning="nuclear-fuel"
-- event.created_entity.burner.remaining_burning_fuel=1210000000
end
end
Code: Select all
on_robot_built_entity (event)
Code: Select all
on_built(event)