[15.13] [Rseding91] LuaSurface.get_trains(nil) errors

Bugs that are actually features.
Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

[15.13] [Rseding91] LuaSurface.get_trains(nil) errors

Post by Choumiko »

Using

Code: Select all

/c criteria = {surface = 'nauvis', force=nil} game.surfaces[criteria.surface].get_trains(criteria.force)
--or even
/c game.surfaces.nauvis.get_trains(nil)
results in "Error: Given force is not valid"

On the other hand

Code: Select all

/c criteria = {surface = 'nauvis', force=nil} game.surfaces[criteria.surface].find_entities_filtered(criteria)
works fine.

Both functions state that force is an optional parameter.

Expected behaviour: LuaSurface.get_trains(nil) should work by returning the trains of all forces.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15993
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.13] [Rseding91] LuaSurface.get_trains(nil) errors

Post by Rseding91 »

You're passing "nil" in which is not a valid force. Pass nothing and it will work as you want.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Not a bug”