Page 1 of 1

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

Posted: Fri May 26, 2017 10:29 am
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.

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

Posted: Sat May 27, 2017 9:31 am
by Rseding91
You're passing "nil" in which is not a valid force. Pass nothing and it will work as you want.