aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-09-04 20:25:12 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-09-04 20:25:12 +0200
commit606fc83465d8742550e9f70a13b51bbb9cd6f45e (patch)
tree0a1f5da2334b95b44aab2db6322b3c827d9ec89b
parent0aa83e49322e7df2ccfb6e4b8490bc10163d593a (diff)
downloadadvtrains-606fc83465d8742550e9f70a13b51bbb9cd6f45e.tar.gz
advtrains-606fc83465d8742550e9f70a13b51bbb9cd6f45e.tar.bz2
advtrains-606fc83465d8742550e9f70a13b51bbb9cd6f45e.zip
localize split function to prevent conflicts with the builtin one
-rw-r--r--advtrains/wagons.lua6
1 files 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