If you attempt to give the following command to a LuaEntity or LuaUnitGroup, you get a very misleading error message in return:
Code: Select all
.set_command({
type = defines.command.attack_area,
radius = 40,
destination = nil,
distraction = defines.distraction.by_anything,
})
You get this message in return:
Code: Select all
bad argument #-1 to 'set_command' (table expected, got nil)
Which makes you hunt the code for any place where you could possibly somehow end up doing .set_command(nil). And then you can't find it, and the error still happens. And then you rip out your hair and start verifying all parameters to all commands, and then after 6 days and 6 nights of labor, you figure out the above, make this post, and rest on the 7th day.
I'm joking, of course - it took me literally 3 seconds to figure out my mistake. But I can envision less experienced programmers having a traumatic experience like the above
Thank you!