From 606fc83465d8742550e9f70a13b51bbb9cd6f45e Mon Sep 17 00:00:00 2001 From: Gabriel PĂ©rez-Cerezo Date: Fri, 4 Sep 2020 20:25:12 +0200 Subject: localize split function to prevent conflicts with the builtin one --- advtrains/wagons.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/advtrains/wagons.lua b/advtrains/wagons.lua index d10dce0..6f72d92 100644 --- a/advtrains/wagons.lua +++ b/advtrains/wagons.lua @@ -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 -- cgit v1.2.3