set_driver() and set_passenger() parameters are not optional
Posted: Thu Jun 19, 2025 1:36 am
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".
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".