Page 1 of 1

set_driver() and set_passenger() parameters are not optional

Posted: Thu Jun 19, 2025 1:36 am
by robot256
LuaEntity::set_driver() and LuaEntity::set_passenger() both list the parameter with a "?" at the end, implying that the parameter is optional. However, calling either function with 0 parameters will cause a script error.

You must explicitly write "nil" in the argument list in order to use the "eject player" functionality. This should be spelled out clearly because most functions in Lua treat omitted arguments as nil, but I understand the C++ API handles things a little differently. Therefore the "?" should be removed from the parameter list, and the parameter description should read "LuaEntity or PlayerIdentification or nil".

Re: set_driver() and set_passenger() parameters are not optional

Posted: Thu Jun 19, 2025 2:53 pm
by Bilka
Thanks, fixed for 2.0.57.