Skip to content

Commit

Permalink
localize split function to prevent conflicts with the builtin one
Browse files Browse the repository at this point in the history
  • Loading branch information
gpcf committed Sep 4, 2020
1 parent 0aa83e4 commit 606fc83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions advtrains/wagons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -848,15 +848,15 @@ local function checklock(pname, own1, own2, wl1, wl2)
or advtrains.check_driving_couple_protection(pname, own2, wl2)
end

function string:split(sep)
local function split(str, sep)
local fields = {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
str:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end

function wagon.set_fc(data, fcstr)
data.fc = string.split(fcstr, "!")
data.fc = split(fcstr, "!")
if not data.fcind then
data.fcind = 1
elseif data.fcind > #data.fc then
Expand Down

0 comments on commit 606fc83

Please sign in to comment.