[2.0.37] LuaSchedule::add_record can not add permanent rail stops
Posted: Fri Feb 28, 2025 3:24 am
(not sure if this is a bug or an API limitation)
Adding a temporary rail stop:
Doing the same thing for a permanent stop:
The created record will not work (there is no stop called ""). This should either error out, or not add a record.
Adding a temporary rail stop:
Code: Select all
> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
(nil)
> train_schedule.add_record { rail = rail, temporary = true }
(nil)
> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
{allows_unloading = true, created_by_interrupt = false, rail = "[LuaEntity: legacy-straight-rail at [gps=227.0,-1.0]]", temporary = true, wait_conditions = {{compare_type = "and", ticks = 300, type = "time"}}}
(nil)
Code: Select all
> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
(nil)
> train_schedule.add_record { rail = rail }
(nil)
> for i = 1, train_schedule.get_record_count() do print(serpent.line(train_schedule.get_record{ schedule_index = i })) end
{allows_unloading = true, created_by_interrupt = false, station = "", temporary = false, wait_conditions = {}}
(nil)