sub
Definition
-- @/=[C]:-1
function sub(...)
Callers
@/lua/vehicle/partCondition.lua
result[partId] = getCondition(partId)
--log("I", "partCondition.getConditions", string.format("Got condition for partId %25s: ", partId) .. string.sub(serialize(result[partId]), 1, 100))
end,
@/lua/common/utils.lua
return color(v.r, v.g, v.b, v.a)
elseif type(v) == 'string' and string.len(v) > 7 and v:sub(1,1) == '#' then
v = v:gsub("#","")
v = v:gsub("#","")
return color(tonumber("0x"..v:sub(1,2)), tonumber("0x"..v:sub(3,4)), tonumber("0x"..v:sub(5,6)), tonumber("0x"..v:sub(7,8)))
elseif v == nil then
v = v:gsub("#","")
return color(tonumber("0x"..v:sub(1,2)), tonumber("0x"..v:sub(3,4)), tonumber("0x"..v:sub(5,6)), tonumber("0x"..v:sub(7,8)))
elseif v == nil then
v = v:gsub("#","")
return color(tonumber("0x"..v:sub(1,2)), tonumber("0x"..v:sub(3,4)), tonumber("0x"..v:sub(5,6)), tonumber("0x"..v:sub(7,8)))
elseif v == nil then
v = v:gsub("#","")
return color(tonumber("0x"..v:sub(1,2)), tonumber("0x"..v:sub(3,4)), tonumber("0x"..v:sub(5,6)), tonumber("0x"..v:sub(7,8)))
elseif v == nil then
function string.startswith(String,Start)
return string.sub(String,1,string.len(Start))==Start
end
function string.endswith(String,End)
return End=='' or string.sub(String,-string.len(End))==End
end
local result = str:gsub("([A-Z])", " %1")
return string.upper(result:sub(1, 1)) .. result:sub(2)
end
local result = str:gsub("([A-Z])", " %1")
return string.upper(result:sub(1, 1)) .. result:sub(2)
end
for k, expectedType in ipairs(expectedTypes) do
local isOptional = expectedType:sub(0,9) == "optional:"
local sanitizedExpectedType = isOptional and expectedType:sub(10, #expectedType) or expectedType
local isOptional = expectedType:sub(0,9) == "optional:"
local sanitizedExpectedType = isOptional and expectedType:sub(10, #expectedType) or expectedType
local actualType = type(data[k])
while true do
if filename == "" or string.sub(filename, -1) == "/" then
break
end
filename = string.sub(filename, 1, -2)
end
for _, lvlPath in ipairs(FS:findFiles('/levels/', '*', 0, false, true)) do
table.insert(ret, string.lower(lvlPath:sub(9)))
end
if string.len(line) > 0 then
local firstChar = string.sub(line, 1, 1)
if firstChar ~= '#' and firstChar ~= ';' and firstChar ~= '/' then
@/lua/ge/extensions/flowgraph/nodes/input/blacklistAction.lua
if not pos2 then
im.Text(label:sub(pos1))
break
elseif pos1 < pos2 then
im.Text(label:sub(pos1, pos2 - 1))
im.SameLine()
local pos3 = pos2 + highlightLowerLen
im.TextColored(matchColor, label:sub(pos2, pos3))
im.SameLine()
@/lua/common/tech/pcdLib.lua
function Pcd:addField(name, size, type)
type = string.sub(type, 1, 1):upper()
local n = #self.fields + 1
@/lua/ge/extensions/editor/dynamicDecals/layerTypes/decal.lua
local dir, fileName, fileExt = path.split(api.getDecalTexturePath("color"))
newBrushName = string.sub(fileName, 1, #fileName - (#fileExt + 1))
im.OpenPopup("SaveBrushPopup")
if im.InputText(string.format("##%s_%s", guiId, "decalLayerFontCharacter"), editor.getTempCharPtr(api.getDecalLayerFontCharacter()), nil, im.InputTextFlags_AutoSelectAll) then
api.setDecalLayerFontCharacter(string.sub(editor.getTempCharPtr(), 1, 1))
end
@/lua/ge/extensions/editor/assemblySpline/import.lua
for _, anchorName in ipairs(obj:getAnchorNames()) do -- Check if any anchor points have the nail prefix.
if anchorName:sub(1, 5) == anchorPrefixStr .. '.' then
return true
@/lua/ge/extensions/editor/levelValidator.lua
im.PushStyleColor2(im.Col_Text, logColor)
local textSize = im.CalcTextSize(logItem.message:sub(1, 1000) or "", nil, nil, im.GetColumnWidth(2) - im.GetStyle().ItemSpacing.x)
if im.Selectable1(" " .. (logItem.logLevel or "") .. "##" .. i, selected == i, im.SelectableFlags_SpanAllColumns, im.ImVec2(0, textSize.y + 5)) then
-- Add [IGNORED] prefix for ignored items
local displayMessage = logItem.message:sub(1, 1000) or ""
if isIgnored then
@/lua/common/extensions/ui/flowgraph/editor.lua
elseif tpe == 'string' or tpe == 'bool' or tpe == 'boolean' then
return (tostring(value):sub(0, 10) .. (tostring(value):len() > 10 and "..." or ""))
elseif tpe == 'number' then
@/lua/ge/extensions/editor/dynamicDecals/fonts.lua
local dir, filename, ext = path.split(file)
local fontName = string.sub(filename, 1, #filename - #fontAtlasJsonExtension)
local success = false
local path, filename, ext = path.split(fontPath)
local fontName = string.sub(filename, 1, #filename - (#ext + 1))
if not tableContains(generatedFontAtlases, fontName) then
@/lua/ge/extensions/editor/flowgraph/properties.lua
if data.filepath:find(pin.node.mgr.savedDir) then
sel = data.filepath:sub(pin.node.mgr.savedDir:len()+1,-1)
end
if validExt then
local shortPath = file:sub(pin.node.mgr.savedDir:len()+1,-1)
if im.Selectable1(shortPath) then
@/lua/common/utils/pixellib.lua
for i = 1, string.len(text) do
local c = string.sub(text, i, i)
if c == ' ' then
for dx = 1, string.len(cl[dy]) do
local cf = string.sub(cl[dy], dx, dx)
if cf ~= ' ' then
@/lua/ge/extensions/editor/dynamicDecals/export.lua
-- local maps = {"_color", "_colorPalette"}
local dirPath = string.sub(texturesExport_DirectoryPath, -1) == "/" and texturesExport_DirectoryPath or texturesExport_DirectoryPath .. "/"
@/lua/ge/extensions/util/compileMeshes.lua
local src = f
local dst = dir1 .. filename:sub(1, -4) .. 'cdae'
local dstData = '' -- dir1 .. filename:sub(1, -4) .. 'meshes.json' -- do not use this feature for now
local dst = dir1 .. filename:sub(1, -4) .. 'cdae'
local dstData = '' -- dir1 .. filename:sub(1, -4) .. 'meshes.json' -- do not use this feature for now
local cacheFilename = nil
@/lua/ge/extensions/flowgraph/nodes/string/subString.lua
function C:work()
self.pinOut.value.value = string.sub(self.pinIn.value.value, self.data.from, self.data.to)
end
@/inspector/External/three.js/OrbitControls.js
offset.copy( position ).sub( scope.target );
var position = scope.object.position;
offset.copy( position ).sub( scope.target );
var targetDistance = offset.length();
@/lua/ge/extensions/editor/engineAudioDebug.lua
local dataString = jsonEncodePretty(data)
dataString = dataString:sub(3, dataString:len() - 2)
setClipboard(dataString)
@/lua/vehicle/controller/vehicleController/shiftLogic/cvtGearbox.lua
local manualModeIndex
if string.sub(automaticHandling.mode, 1, 1) == "M" then
manualModeIndex = string.sub(automaticHandling.mode, 2)
if string.sub(automaticHandling.mode, 1, 1) == "M" then
manualModeIndex = string.sub(automaticHandling.mode, 2)
end
for i = 1, modeCount do
local mode = modes:sub(i, i)
if automaticHandling.availableModeLookup[mode] then
@/lua/ge/extensions/editor/flowgraph/search.lua
if not pos2 then
im.Text(label:sub(pos1))
break
elseif pos1 < pos2 then
im.Text(label:sub(pos1, pos2 - 1))
im.SameLine()
local pos3 = pos2 + highlightLowerLen
im.TextColored(matchColor, label:sub(pos2, pos3))
im.SameLine()
if match:find(t..": ") ~= nil then
return t, string.sub(match, #t+3)
end
if match:find(t..":") ~= nil then
return t, string.sub(match, #t+2)
end
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
-- local s = dataString:tostring()
-- lo('?? ss:'..string.sub(s, 1, 100))
--[[
local c=0
for i=1,8 do c=c+(x:sub(i,i)=='1' and 2^(8-i) or 0) end
return string.char(c)
-- local s = ffi.string(dataString:get()) --res)
-- lo('?? ss:'..string.sub(res, 1, 100))
@/lua/ge/server/server.lua
local levelDir = path.dirname(levelPath)
if string.sub(levelDir, -1) ~= '/' then
levelDir = levelDir.."/"
@/lua/common/graphpath.lua
local i = string.find(id, delim)
return string.sub(id, 1, i-1), string.sub(id, i+1, #id)
end
local i = string.find(id, delim)
return string.sub(id, 1, i-1), string.sub(id, i+1, #id)
end
@/lua/ge/extensions/career/saveSystem.lua
else
local newPath = string.sub(folders[i], oldNameLength + 2)
newPath = newName .. newPath
@/lua/ge/extensions/editor/dynamicDecals/brushes.lua
local dir, fileName, fileExt = path.split(decalColorTexturePath)
name = string.sub(fileName, 1, #fileName - (#fileExt + 1))
end
@/lua/vehicle/energyStorage.lua
local _, fileNameWithExt, _ = path.split(file)
local fileName = fileNameWithExt:sub(1, -5)
local storageFactoryPath = "energyStorage/" .. fileName
@/lua/ge/extensions/editor/dataBlockEditor.lua
resultTable[name] = {}
stringList = stringList:sub(last+1)
else
@/lua/ge/extensions/career/modules/inventory.lua
local dir, filename, ext = path.split(files[i])
local fileNameNoExt = string.sub(filename, 1, -6)
local inventoryId = tonumber(fileNameNoExt)
@/lua/common/libs/luasocket/socket/mbox.lua
if not i then break end
local message = string.sub(mbox_s, j, i-1)
table.insert(mbox, message)
@/lua/common/lpack.lua
end
r = tonumber(sub(s, seridx + 1, i - 1))
end
seridx = strs + strlen
return sub(s, strs, seridx-1), byte(s, seridx), seridx
end
@/lua/ge/extensions/ui/topBar.lua
for _, substate in pairs(item.substates) do
if string.sub(M.state.currentUIState, 1, #substate) == substate then
M.state.activeItem = item.id
-- -- remove leading slash from state
-- if type(state) == "string" and string.sub(state, 1, 1) == "/" then
-- state = string.sub(state, 2)
-- if type(state) == "string" and string.sub(state, 1, 1) == "/" then
-- state = string.sub(state, 2)
-- end
-- -- TODO: popup check is a hack for now. maybe we can check popup state from lua instead
-- if not opened or M.state.currentUIState == state or (type(state) == "string" and string.sub(state, 1, 5) == "popup") then
-- return
@/lua/ge/extensions/core/audio.lua
local function cacheSetEntry(bankFilePath)
if string.sub(bankFilePath, 1, 1) ~= '/' then
bankFilePath = "/"..bankFilePath
local function cacheClearEntry(bankFilePath)
if string.sub(bankFilePath, 1, 1) ~= '/' then
bankFilePath = "/"..bankFilePath
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
filepath = "/"..filepath
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
filepath = "/"..filepath
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
filepath = "/"..filepath
for _,filepath in ipairs(bankFiles) do
if string.sub(filepath, 1, 1) ~= '/' then
filepath = "/"..filepath
end
if string.sub(path, 1, 1) ~= '/' then
path = "/"..path
local function loadLevelBank(bankFilePath)
if string.sub(bankFilePath, 1, 1) ~= '/' then
bankFilePath = "/"..bankFilePath
local function loadVehicleBank(bankPath)
if string.sub(bankPath, 1, 1) ~= '/' then
bankPath = "/"..bankPath
-- make sure the key we use here matches that used previously in loadBaseBank
if string.sub(filename, 1, 1) ~= '/' then
filename = "/"..filename
@/lua/ge/extensions/util/dependencyTree.lua
if rootNode and rootNode.materials and #rootNode.materials > 0 then
local entity = { deps = { material = {}}, provides = { shape = shapeInfoFn:sub(1, -13) }}
for _, m in pairs(rootNode.materials) do
@/lua/ge/extensions/editor/preferences.lua
if string.len(defVal) > 100 then
defVal = string.sub(defVal, 1, 100) .. "..."
end
@/lua/ge/extensions/editor/assetManagementTool.lua
if string.sub(path, 1, size) == newPathNotSetString then
return false
for hash, asset in pairs(assetsByHash) do
if string.sub(asset.targetPath, 1, size) == newPathNotSetString then
return false
@/lua/vehicle/controller/drivingDynamics/actuators/electronicSplitShaftLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/ge/extensions/editor/util/editorElementHelper.lua
if key ~= "fieldName" and string.startswith(key, "fieldName") then
table.insert(ret, {label = string.sub(key, 10), fieldName = elem[key], elemLabel = elem.label})
end
@/lua/ge/extensions/util/procTrack.lua
while i*5 < #word do
local w = string.sub(word, 1+ i*5, 5+i*5)
@/lua/ge/extensions/core/vehicles.lua
if dir and filename and ext and string.lower(ext) == "pc" then
local pcfn = filename:sub(1, #filename - 3)
res.configs[pcfn] = { Configuration = pcfn}
for _, filename in ipairs(jfiles) do
if string.lower(filename:sub(-18)) == '.paintlibrary.json' then
table.insert(filesPaints, filename)
table.insert(filesPaints, filename)
elseif string.lower(filename:sub(-5)) == '.json' then
table.insert(filesJson, filename)
table.insert(filesJson, filename)
elseif string.lower(filename:sub(-3)) == '.pc' then
table.insert(filesPC, filename)
table.insert(filesPC, filename)
elseif string.lower(filename:sub(-4)) == '.png' or string.lower(filename:sub(-4)) == '.jpg' then
filesImages[filename] = true
table.insert(filesPC, filename)
elseif string.lower(filename:sub(-4)) == '.png' or string.lower(filename:sub(-4)) == '.jpg' then
filesImages[filename] = true
for _, filename in ipairs(jfiles) do
if string.lower(filename:sub(-18)) == '.paintlibrary.json' then
table.insert(filesPaints, filename)
table.insert(filesAll, filename)
elseif string.lower(filename:sub(-5)) == '.json' then
table.insert(filesJson, filename)
table.insert(filesAll, filename)
elseif string.lower(filename:sub(-3)) == '.pc' then
table.insert(filesPC, filename)
table.insert(filesAll, filename)
elseif string.lower(filename:sub(-4)) == '.png' or string.lower(filename:sub(-4)) == '.jpg' then
filesImages[filename] = true
table.insert(filesAll, filename)
elseif string.lower(filename:sub(-4)) == '.png' or string.lower(filename:sub(-4)) == '.jpg' then
filesImages[filename] = true
local vehicleDirectory = path or '/vehicles/' .. model .. '/'
if string.sub(vehicleDirectory, -1) ~= '/' then vehicleDirectory = vehicleDirectory .. '/' end
local res = FS:findFiles(vehicleDirectory, '*.jbeam', -1, false, false) -- recursive search
return 'BeamNG - Official'
elseif string.sub(path, -3) == '.pc' then
return 'Custom'
local fLower = string.lower(filename)
if string.sub(fLower, -5) == '.json'
or string.sub(fLower, -6) == '.jbeam'
if string.sub(fLower, -5) == '.json'
or string.sub(fLower, -6) == '.jbeam'
or string.sub(fLower, -3) == '.pc'
or string.sub(fLower, -6) == '.jbeam'
or string.sub(fLower, -3) == '.pc'
or string.sub(fLower, -4) == '.jpg'
or string.sub(fLower, -3) == '.pc'
or string.sub(fLower, -4) == '.jpg'
or string.sub(fLower, -4) == '.png' then
or string.sub(fLower, -4) == '.jpg'
or string.sub(fLower, -4) == '.png' then
anyCacheFileModified = true
@/lua/vehicle/controller/drivingDynamics/actuators/activeCenterDiffLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/vehicle/controller/driveModes.lua
for k, v in pairs(jbeamData) do
if k:sub(1, #"modes") == "modes" then
tableMergeRecursive(modeData, v)
if k:sub(1, #"enabledModes") == "enabledModes" then
for _, modeKey in pairs(v) do
@/lua/ge/extensions/core/commandhandler.lua
if arg1:startswith('beamng:') then
onSchemeCommand(arg1:sub(8), true) -- strip 'beamng:'
break
@/lua/ge/extensions/core/quickAccess.lua
end
if string.sub(args.level, string.len(args.level)) ~= '/' then args.level = args.level .. '/' end -- make sure there is always a trailing slash in the level
@/lua/ge/extensions/editor/missionEditor.lua
else
shortId = clickedMission.id:sub(f+1,t)
end
table.insert(files, f)
local dir, filename, ext =path.split(string.sub(f, 2+string.len(lastShownMission.missionFolder)))
if dir then
@/lua/common/jsonDebug.lua
local infend = si + 6
if sub(s, si, infend) == "1#INF00" then
return math.huge, infend + 1
local pm = byte(s, si - 1)
jsonError(string.format("Invalid number: '%s'", sub(s, si - ((pm == 45 or pm == 43) and 1 or 0), infend)), si)
end
end
r = tonumber(sub(s, si, i - 1))
if r == nil then
local pm = byte(s, si - 1)
jsonError(string.format("Invalid number: '%s'", sub(s, si - ((pm == 45 or pm == 43) and 1 or 0), i-1)), si)
end
if ch == 34 then -- "
return sub(s, si1, i - 2), i
end
i = i - 1
key = sub(s, si, i)
@/lua/ge/extensions/editor/barriersEditor.lua
local scenetreeObject = spawnPrefab("prefab_temp_" .. filename ..os.time(), f, "0 0 0 ", "0 0 1", "1 1 1")
local short = f:sub(levelPartLength)
local dirInLevel, _,_ = path.splitWithoutExt(short)
@/lua/common/libs/luaqrcode/qrencode.lua
if #a == 2 then
b1 = asciitbl[string.byte(string.sub(a,1,1))]
b2 = asciitbl[string.byte(string.sub(a,2,2))]
b1 = asciitbl[string.byte(string.sub(a,1,1))]
b2 = asciitbl[string.byte(string.sub(a,2,2))]
int = b1 * 45 + b2
cpty_ec_bits = cpty_ec_bits + size_ecblock_bytes * 8
datablocks[#datablocks + 1] = string.sub(data, pos * 8 + 1,( pos + size_datablock_bytes)*8)
local tmp_tab = calculate_error_correction(datablocks[#datablocks],size_ecblock_bytes)
if pos < #datablocks[i] then
arranged_data = arranged_data .. string.sub(datablocks[i],pos, pos + 7)
end
if pos < #ecblocks[i] then
arranged_ec = arranged_ec .. string.sub(ecblocks[i],pos, pos + 7)
end
for i=1,7 do
bit = string.sub(ec_mask_type,i,i)
fill_matrix_position(matrix, bit, 9, #matrix - i + 1)
for i=8,9 do
bit = string.sub(ec_mask_type,i,i)
fill_matrix_position(matrix,bit,9,17-i)
for i=10,15 do
bit = string.sub(ec_mask_type,i,i)
fill_matrix_position(matrix,bit,9,16 - i)
for i=1,6 do
bit = string.sub(ec_mask_type,i,i)
fill_matrix_position(matrix,bit,i,9)
end
bit = string.sub(ec_mask_type,7,7)
fill_matrix_position(matrix,bit,8,9)
for i=8,15 do
bit = string.sub(ec_mask_type,i,i)
fill_matrix_position(matrix,bit,#matrix - 15 + i,9)
for i=1,#bitstring do
bit = string.sub(bitstring,i,i)
x = start_x + math.fmod(i - 1,3)
for i=1,#bitstring do
bit = string.sub(bitstring,i,i)
x = start_x + math.floor( (i - 1) / 3 )
_y = positions[i][2]
m = get_pixel_with_mask(mask,_x,_y,string.sub(byte,i,i))
if debugging then
@/lua/ge/extensions/flowgraph/nodes/types/string.lua
if #self.string > 10 then
im.Text(self.string:sub(1,10).. "...")
else
@/lua/ge/extensions/flowgraph/states.lua
for k, func in pairs(node) do
if string.sub(k, 1, 2) == 'on' and type(func) == 'function' then
self.hookExists[k] = true
@/lua/ge/extensions/gameplay/missions/missions.lua
while string.endswith(missionData.description, "\n") do
missionData.description = string.sub(missionData.description, 1, -2)
end
--dump(missionId)
missionId = string.sub(missionDir, #missionsDir+1)
missionData.id = missionId
local missionDir, _, _ = path.split(missionInfo)
missionDir = string.sub(missionDir,0,-2)
local missionData = loadMission(missionDir)
for _, file in ipairs(files) do
local gen = require(file:sub(0,-5))
gen.generate = gen.generate or nop
@/lua/ge/extensions/editor/decalEditor.lua
local _, _, ext = path.split(fileName)
local fileNameNoExt = string.sub(fileName, 1, -(ext:len() + 1))
if not FS:fileExists(fileNameNoExt .. "png") and not FS:fileExists(fileNameNoExt .. "dds") then
@/lua/ge/extensions/gameplay/rally/util.lua
local str = hashStringSHA1(s)
return str:sub(1, 16)
end
if thepath:sub(-1) == "/" then
thepath = thepath:sub(1, -2)
if thepath:sub(-1) == "/" then
thepath = thepath:sub(1, -2)
end
if dirname:sub(-1) == "/" then
dirname = dirname:sub(1, -2)
if dirname:sub(-1) == "/" then
dirname = dirname:sub(1, -2)
end
local hash = hashStringSHA1(randomStr)
return string.sub(hash, 1, 8)
end
@/lua/ge/extensions/util/docCreator.lua
if out.pidvid then
out.pid = out.pidvid:sub(1, 4)
out.vid = out.pidvid:sub(5, 8)
out.pid = out.pidvid:sub(1, 4)
out.vid = out.pidvid:sub(5, 8)
end
if info.vendorName then
if string.lower(string.sub(name, 1, string.len(info.vendorName))) == string.lower(info.vendorName) then
name = string.sub(name, string.len(info.vendorName) + 1)
if string.lower(string.sub(name, 1, string.len(info.vendorName))) == string.lower(info.vendorName) then
name = string.sub(name, string.len(info.vendorName) + 1)
name = name:gsub("^%s+", "") -- strip whitespaces
@/lua/ge/extensions/editor/flowgraph/references.lua
if not pos2 then
im.Text(label:sub(pos1))
break
elseif pos1 < pos2 then
im.Text(label:sub(pos1, pos2 - 1))
im.SameLine()
local pos3 = pos2 + highlightLowerLen
im.TextColored(matchColor, label:sub(pos2, pos3))
im.SameLine()
@/lua/common/extensions/ui/imgui_custom_luaintf.lua
if not pos2 then
M.Text(label:sub(pos1))
break
elseif pos1 < pos2 then
M.Text(label:sub(pos1, pos2 - 1))
M.SameLine()
local pos3 = pos2 + highlightLowerLen
M.TextColored(matchColor, label:sub(pos2, pos3))
M.SameLine()
@/lua/common/jbeam/sections/meshs.lua
return ColorF(v.r / 255, v.g / 255, v.b / 255, v.a / 255)
elseif type(v) == 'string' and string.len(v) > 7 and v:sub(1,1) == '#' then
v = v:gsub("#","")
v = v:gsub("#","")
return ColorF(tonumber("0x"..v:sub(1,2)) / 255, tonumber("0x"..v:sub(3,4)) / 255, tonumber("0x"..v:sub(5,6)) / 255, tonumber("0x"..v:sub(7,8)) / 255)
end
v = v:gsub("#","")
return ColorF(tonumber("0x"..v:sub(1,2)) / 255, tonumber("0x"..v:sub(3,4)) / 255, tonumber("0x"..v:sub(5,6)) / 255, tonumber("0x"..v:sub(7,8)) / 255)
end
v = v:gsub("#","")
return ColorF(tonumber("0x"..v:sub(1,2)) / 255, tonumber("0x"..v:sub(3,4)) / 255, tonumber("0x"..v:sub(5,6)) / 255, tonumber("0x"..v:sub(7,8)) / 255)
end
v = v:gsub("#","")
return ColorF(tonumber("0x"..v:sub(1,2)) / 255, tonumber("0x"..v:sub(3,4)) / 255, tonumber("0x"..v:sub(5,6)) / 255, tonumber("0x"..v:sub(7,8)) / 255)
end
@/lua/ge/extensions/editor/raceEditor.lua
table.insert(allFiles,{
name = string.sub(filename,1,-11),
file = f
@/lua/ge/extensions/gameplay/drift/saveLoad.lua
local dir, _, _ = path.split(file)
local spotId = level .."/".. string.sub(dir, #levelSpotsDir+1, -2)
-- main data
@/lua/ge/extensions/ui/liveryEditor/camera.lua
local switchOrder = {"right", "front", "left", "back"}
local startsWithTop = string.sub(orthographicView, 1, 3) == "top"
if startsWithTop and y == -1 then
local view = string.sub(orthographicView, 4)
M.setOrthographicView(view)
@/lua/ge/extensions/editor/assemblySpline/molecule.lua
for _, anchorName in ipairs(anchorNames) do
if anchorName:sub(1, 5) == anchorPrefixStrWithDot then
local parts = {}
@/lua/ge/extensions/core/schemeCommandServer.lua
if string.startswith(data, 'beamng:') then
commandhandler.onSchemeCommand(data:sub(8))
end
@/lua/ge/extensions/core/flowgraphManager.lua
local function reInitOnFileChange(filename)
local requireFilename = string.sub(filename, 1, string.len(filename) - 4)
log("I","flowgraphManager","Reloading Node: " .. tostring(requireFilename))
-- check basic nodes
if filename:sub(1, string.len(nodePath)) == nodePath then
reInitOnFileChange(filename)
-- check custom nodes
if filename:sub(string.len(filename)-7,string.len(filename)) == 'Node.lua' then
for _,manager in ipairs(managers) do
local dirname, fn, e = path.split(filename)
local path = dirname:sub(string.len(nodePath) + 1)
local pathArgs = split(path, '/')
end
local moduleName = string.sub(fn, 1, string.len(fn) - 4)
local requireFilename = string.sub(filename, 1, string.len(filename) - 4)
local moduleName = string.sub(fn, 1, string.len(fn) - 4)
local requireFilename = string.sub(filename, 1, string.len(filename) - 4)
local dirname, fn, e = path.splitWithoutExt(filename, true)
local path = dirname:sub(string.len(stateTemplatePath) + 1)
if path ~= "" then
local moduleName = fn
--local requireFilename = string.sub(filename, 1, string.len(filename) - 4)
local stateData = {}
@/lua/common/jit/v.lua
local oidx = 6 * info
info = sub(vmdef.bcnames, oidx+1, oidx+6)
end
@/lua/ge/extensions/scenario/scenariosLoader.lua
scenarioData.sourceFile = scenarioFilename
scenarioData.official = isOfficialContentVPath(string.sub(scenarioFilename, 0))
scenarioData.levelName = string.gsub(scenarioFilename, "(.*/)(.*)/scenarios/(.*)%.json", "%2")
if string.startswith(p, scenarioData.directory) then
local imageFilename = string.sub(p, string.len(scenarioData.directory) + 2, string.len(p) - 4)
local foundClash = false
@/lua/common/libs/luasec/options.lua
for k, option in ipairs(options) do
local name = string.lower(string.sub(option, 8))
print(string.format([[#if defined(%s)]], option))
@/lua/ge/extensions/flowgraph/nodes/util/closestRoad.lua
if index == 1 then
local short = string.sub(name,length+1,string.len(name))
local underscoreIndex = string.find(short,"_")
if underscoreIndex and underscoreIndex >= 0 then
local rdId = tonumber(string.sub(short,1,underscoreIndex-1))
if not idId then
if not idId then
local obj = scenetree.findObject(string.sub(short,1,underscoreIndex-1))
if obj then
end
local rdIdx = tonumber(string.sub(short,underscoreIndex+1,string.len(short)))
return rdId, rdIdx
@/lua/ge/extensions/editor/terrainMaterialsEditor.lua
if im.InputText("##MaterialNameInput", terrainMtlCopyProxy.nameInput, nil, im.flags(im.InputTextFlags_CharsNoBlank)) then
local firstChar = tonumber(string.sub(ffi.string(terrainMtlCopyProxy.nameInput), 1, 1))
if firstChar and type(firstChar) == "number" then
@/lua/vehicle/controller.lua
for _, v in pairs(loadedControllers) do
if v.typeName:sub(1, #path) == path then
table.insert(controllers, v)
@/lua/common/jsonPrettyEncoderCustom.lua
-- collapse anything below bindings that has less than 4 items
return path:sub(1,10) == '/bindings/' and tableSize(item) < 4
end
@/gameplay/missionTypes/busMode/constructor.lua
if hex:len() == 3 then
return {(tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255, 1}
else
if hex:len() == 3 then
return {(tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255, 1}
else
if hex:len() == 3 then
return {(tonumber("0x"..hex:sub(1,1))*17)/255, (tonumber("0x"..hex:sub(2,2))*17)/255, (tonumber("0x"..hex:sub(3,3))*17)/255, 1}
else
else
return {tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255, 1}
end
else
return {tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255, 1}
end
else
return {tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255, 1}
end
@/lua/ge/extensions/editor/sidewalkSpline/kit.lua
local anchorName = anchorNames[i]
if anchorName:sub(1, 9) == anchorPrefixStrWithDot then
table.clear(tmpParts) -- Clear the reusable table.
@/lua/common/libs/luasec/ssl.lua
local len = str:byte(i)
array[#array + 1] = str:sub(i + 1, i + len)
i = i + len + 1
@/lua/vehicle/controller/drivingDynamics/CMU.lua
if slashPos then
controllerName = controllerName:sub(slashPos + 1)
end
@/lua/ge/extensions/core/levels.lua
if levelPath:find('main.level.json') and not FS:fileExists(levelPath) then
local newName = levelPath:sub(0, levelPath:find('main.level.json') - 1)
if FS:directoryExists(newName) then
@/lua/vehicle/powertrain.lua
local _, file, _ = path.split(filePath)
local fileName = file:sub(1, -5)
if not factoryBlackList[fileName] then
local v = deviceJbeamData[device.name][k]
if k:sub(1, 12) == "deformGroups" then --check for magic prefix
local delim = "_" --underscore is used as the delim (eg "deformGroups_turbo")
@/lua/common/libs/LuaIRC/util.lua
local lineStart = 1
if line:sub(1,1) == ":" then
local space = line:find(" ")
local space = line:find(" ")
prefix = line:sub(2, space-1)
lineStart = space
if trailToken then
trailing = line:sub(trailToken + 1)
lineStop = trailToken - 2
local randindex = random(1, #nick)
local randchar = sub(nick, randindex, randindex)
local b = byte(randchar)
-- Get the halves before and after the changed character
local first = sub(nick, 1, randindex - 1)
local last = sub(nick, randindex + 1, #nick)
local first = sub(nick, 1, randindex - 1)
local last = sub(nick, randindex + 1, #nick)
nick = first..char(b)..last -- Insert the new charachter
@/lua/ge/extensions/util/export.lua
local function _isTextureCookerFilepath(filepath)
if not string.sub(filepath, -4) == ".png" then return false end
return string.match(filepath, "%.color%.png$") or string.match(filepath, "%.normal%.png$") or string.match(filepath, "%.data%.png$")
if not FS:fileExists(filepath) then
if filepath:sub(1, 1) == '@' then
local filepathIn = filepath
elseif _isTextureCookerFilepath(filepath) then
filepath = string.sub(filepath, 1, -5) .. ".dds"
else
local dir, filename, ext = path.splitWithoutExt(filepath)
if filename:endswith(".dds") then filename = filename:sub(1, -5) end
@/lua/ge/extensions/editor/vizHelper.lua
for k, v in ipairs(vizHelper) do
vizHelper[k] = string.sub(v, string.len(artPath) + 1)
end
@/lua/common/libs/xlsxlib/xlsxlib.lua
for i = 1, #col do
local char = col:sub(i, i):byte()
if char < 65 or char > 90 then
@/lua/vehicle/controller/drivingDynamics/actuators/adaptiveDampers.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/common/libs/ezSVG/EzSVG.lua
if type(k) == "number" then return true end
if string.sub(k, 1, k.len("__")) == "__" then return false end
return true
@/lua/common/jbeam/loader.lua
-- the directory needs a leading and trailing slash
if vehicleDir:sub(1, 1) ~= '/' then
vehicleDir = '/' .. vehicleDir
end
if vehicleDir:sub(-1, -1) ~= '/' then
vehicleDir = vehicleDir .. '/'
@/lua/vehicle/controller/vehicleController/vehicleController.lua
local vehicleSpeed = electrics.values.wheelspeed or 0
local speedLimit = (type(gearName) == "string" and gearName:sub(1, 1) == "R") and topSpeedLimitReverse or topSpeedLimit
if speedLimit > 0 then
@/lua/ge/extensions/editor/dynamicDecals/history.lua
for s in actionData:gmatch("[^\n]+") do
table.insert(lines, s:sub(1, toolTipMaxWidth)) -- limit width
end
@/lua/ge/extensions/gameplay/sites/sitesManager.lua
local _, siteName = path.split(site)
if name == string.sub(siteName, 0, -12) then
return site
@/lua/ge/extensions/career/career.lua
local currentSaveSlot, currentSavePath = career_saveSystem.getCurrentSaveSlot()
imgui.Text((string.sub(currentSavePath, string.len(career_saveSystem.getSaveRootDirectory())+2, -1)))
imgui.Separator()
@/lua/common/libs/lua-websockets/websocket/client_ev.lua
end
until response:sub(#response-3) == '\r\n\r\n'
read_io:stop(loop)
@/lua/vehicle/protocols.lua
local filename = filepath:match("[^/]*.lua$")
local name = filename:sub(0, #filename - 4)
local enabled = false
@/lua/common/libs/lua-websockets/websocket/frame.lua
end
return decoded,fin,opcode,encoded_bak:sub(bytes+1),mask
end
if #data > 2 then
reason = data:sub(3)
end
@/lua/ge/extensions/util/worker.lua
local src = daePath
local dst = dir .. filename:sub(1, -4) .. 'cdae'
local dstData = dir .. filename:sub(1, -4) .. 'meshes.json'
local dst = dir .. filename:sub(1, -4) .. 'cdae'
local dstData = dir .. filename:sub(1, -4) .. 'meshes.json'
@/lua/common/libs/luasocket/ltn12.lua
return function()
local chunk = string.sub(s, i, i+_M.BLOCKSIZE-1)
i = i + _M.BLOCKSIZE
@/lua/ge/extensions/core/input/bindings.lua
if string.startswith(device, "xinput") then
local n = string.sub(device, -1, -1) -- get controller number (xinput3 -> 3)
local event = {controller = n, connected = true}
if string.startswith(device, "xinput") then
local n = string.sub(device, -1, -1) -- get controller number (xinput3 -> 3)
local event = {controller = n, connected = false}
@/lua/common/libs/luasocket/socket/url.lua
local function absolute_path(base_path, relative_path)
if string.sub(relative_path, 1, 1) == "/" then return relative_path end
local path = string.gsub(base_path, "[^/]*$", "")
end
if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end
if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end
if string.sub(path, 1, 1) == "/" then parsed.is_absolute = 1 end
if string.sub(path, -1, -1) == "/" then parsed.is_directory = 1 end
return parsed
@/lua/ge/extensions/editor/missionEditor/conditions.lua
for _, file in ipairs(files) do
local aConds = require(file:sub(0,-5))
for key, value in pairs(aConds) do
@/ui/ui-vue/src/modules/mainmenu/routes.js
{ // this state is used to display top/info-bar in menus
path: "/menu.:sub(.*)?",
name: "menu",
@/lua/common/libs/lunajson/lunajson/decoder.lua
local function f_nul()
if sub(json, pos, pos+2) == 'ull' then
pos = pos+3
local function f_fls()
if sub(json, pos, pos+3) == 'alse' then
pos = pos+4
local function f_tru()
if sub(json, pos, pos+2) == 'rue' then
pos = pos+3
local str = sub(json, pos, tmppos)
pos = newpos
@/inspector/External/three.js/three.js
console.warn( 'THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
return this.subVectors( v, w );
console.warn( 'THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
return this.subVectors( v, w );
return this.sub( v1 );
return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
console.warn( 'THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.' );
return this.subVectors( v, w );
this.min.copy( center ).sub( halfSize );
this.max.copy( center ).add( halfSize );
this.min.sub( vector );
this.max.add( vector );
var clampedPoint = v1.copy( point ).clamp( this.min, this.max );
return clampedPoint.sub( point ).length();
target.sub( this.center ).normalize();
target.multiplyScalar( this.radius ).add( this.center );
this.direction.copy( v ).sub( this.origin ).normalize();
segCenter.copy( v0 ).add( v1 ).multiplyScalar( 0.5 );
segDir.copy( v1 ).sub( v0 ).normalize();
diff.copy( this.origin ).sub( segCenter );
segDir.copy( v1 ).sub( v0 ).normalize();
diff.copy( this.origin ).sub( segCenter );
vector3.setFromMatrixPosition( light.target.matrixWorld );
uniforms.direction.sub( vector3 );
uniforms.direction.transformDirection( viewMatrix );
vector3.setFromMatrixPosition( light.target.matrixWorld );
uniforms.direction.sub( vector3 );
uniforms.direction.transformDirection( viewMatrix );
var vec = pt2.clone().sub( pt1 );
return vec.normalize();
point.copy( this.v2 ).sub( this.v1 );
point.multiplyScalar( t ).add( this.v1 );
var tangent = this.v2.clone().sub( this.v1 );
point.copy( this.v2 ).sub( this.v1 );
point.multiplyScalar( t ).add( this.v1 );
this.ray.origin.setFromMatrixPosition( camera.matrixWorld );
this.ray.direction.set( coords.x, coords.y, 0.5 ).unproject( camera ).sub( this.ray.origin ).normalize();
var halfSize = v1.copy( size ).multiplyScalar( 0.5 );
this.min.copy( center ).sub( halfSize );
this.max.copy( center ).add( halfSize );
this.min.sub( vector );
this.max.add( vector );
var clampedPoint = v1.copy( point ).clamp( this.min, this.max );
return clampedPoint.sub( point ).length();
this.cone.lookAt( vector2.sub( vector ) );
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
if key ~= "fieldName" and string.startswith(key, "fieldName") then
table.insert(ret, {label = string.sub(key, 10), fieldName = elem[key], elemLabel = elem.label})
end
@/lua/ge/extensions/scenario/scenarios.lua
for _, wp in ipairs(scenario.lapConfig) do
if wp:sub(1,12) ~= '__generated_' then -- only process non-generated WPs
if scenario.nodes[wp] == nil then
if type(entry) == 'string' then
if not tableContains(triggers, entry) and not tableContains(waypoints, entry) and entry:sub(1,12) ~= '__generated_' then
log('E', logTag, 'Lapconfig entry is Invalid! It should be either a Trigger or Waypoint: '..entry)
@/lua/ge/extensions/editor/flowgraph/examples.lua
local dirname, fn, e = path.splitWithoutExt(filename, true)
local path = dirname:sub(string.len(stateTemplatePath) + 1)
local moduleName = fn
--local requireFilename = string.sub(filename, 1, string.len(filename) - 4)
local lectionData = {}
if not pos2 then
im.Text(label:sub(pos1))
break
elseif pos1 < pos2 then
im.Text(label:sub(pos1, pos2 - 1))
im.SameLine()
local pos3 = pos2 + highlightLowerLen
im.TextColored(matchColor, label:sub(pos2, pos3))
im.SameLine()
@/lua/ge/extensions/campaign/campaignsLoader.lua
campaign.previews = {
imageExistsDefault(campaign.sourcePath..'/'..campaign.sourcePath:sub(index)..'.jpg')
}
@/lua/ge/extensions/gameplay/missions/missionScreen.lua
local previewFile = m.previewFile
if previewFile:sub(1, 1) == "/" then
previewFile = previewFile:sub(2)
if previewFile:sub(1, 1) == "/" then
previewFile = previewFile:sub(2)
end
@/lua/common/extensions.lua
local s = d.source
if s:sub(1,1) == '@' then s = s:sub(2) end
if not s:find(extPath) and s ~= 'lua/ge/extensions/core/jobsystem.lua' and s ~= 'lua/common/luaCore.lua' and s ~= '=[C]' then
local s = d.source
if s:sub(1,1) == '@' then s = s:sub(2) end
if not s:find(extPath) and s ~= 'lua/ge/extensions/core/jobsystem.lua' and s ~= 'lua/common/luaCore.lua' and s ~= '=[C]' then
extPath = extName
if string.sub(extPath, 1, 1) == '/' then -- strip leading '/' if present
extPath = string.gsub(extPath, "/(.*)", "%1")
if string.sub(extPath, 1, 1) == '/' then
extPath = string.gsub(extPath, "/(.*)", "%1") -- strip leading '/' if present
for _,luaFilename in pairs(luaFiles) do
load(luaFilename:sub(1,-5)) -- strip '.lua'
end
-- without it, vehicle extensions like custom_input would come out as custom/input which is wrong
loadAtRoot(file:sub(1,-5), "")
end
-- grab specified root
root = string.sub(extName, 1, string.find(extName, "_") - 1)
end
for k, func in pairs(m) do
if string.sub(k, 1, 2) == 'on' and type(func) == 'function' then
if not hookLists[k] then hookLists[k] = {} end
@/lua/vehicle/main.lua
if j then
local m = _G[string.sub(funName, 1, j - 1)]
if type(m) == "table" then
if type(m) == "table" then
f = m[string.sub(funName, j + 1)]
end
@/lua/ge/extensions/core/environment.lua
if string.len(k) > 31 then
local newk = string.sub(k, 1, 30)
log('E', 'ge.environment.reloadGroundModels', 'Ground model name too long: "' .. tostring(k) .. '" is longer than the supported 31 characters. It will be cut to "' .. tostring(newk) .. '")')
@/lua/ge/extensions/gameplay/missions/progress.lua
for _, file in ipairs(files) do
local aConds = require(file:sub(0, -5))
@/lua/vehicle/controller/drivingDynamics/actuators/adaptiveTorsionBars.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/ge/extensions/editor/resourceChecker.lua
local stringend = ", "
txtstring = string.sub(txtstring, 1, #txtstring - #stringend)
end
@/lua/ge/extensions/util/nodeBeamExport.lua
local dir = vdata.vehicleDirectory
if string.sub(dir, -1) ~= '/' then dir = dir .. '/' end
@/lua/ge/extensions/editor/dynamicDecals/layerStack.lua
local dir, file, ext = path.split(data.filepath)
file = string.sub(file, 1, #file - (#ext + 1))
api.exportLayerMask(layer, dir, file, ext)
@/lua/common/libs/lua-MessagePack/MessagePack.lua
c.i = i+n
return s:sub(i, e)
end
c.i = i+n
return m.build_ext(tag, s:sub(i, e))
end
underflow = function(self, e)
self.s = self.s:sub(self.i)
e = e - self.i + 1
@/lua/common/libs/lua-websockets/websocket/tools.lua
for j=1,#msg,64 do
local chunk = msg:sub(j,j+63)
assert(#chunk==64,#chunk)
@/lua/ge/extensions/editor/gen/world.lua
end)
return string.sub(s, 2)
end
lo('?? for_file:'..fname) --..':'..tostring(#data)..':'..#v..':'..jdata)
fout:write(string.sub(jdata, 2, #jdata-1))
fout:close()
-- if #atkn == 2 then
local scorner = string.sub(dobj.dae,1,ind-1)..'_Sco_'..string.sub(dobj.dae,ind+4)
lo('?? if_SC:'..scorner..':'..tostring(ddae[scorner]))
-- if #atkn == 2 then
local scorner = string.sub(dobj.dae,1,ind-1)..'_Sco_'..string.sub(dobj.dae,ind+4)
lo('?? if_SC:'..scorner..':'..tostring(ddae[scorner]))
jdata = jdata:gsub('},{', '}\r\n{')
outputFile:write(string.sub(jdata, 2, #jdata-1))
lo('?? jDATA:'..#list,true) --..':'..dirname..'/items.level.json'..':'..jdata, true)
local outputFile = io.open(dname..fname, "w")
outputFile:write(cnt..'\r\n'..string.sub(jdata, 2, #jdata-1))
outputFile:close()
@/lua/vehicle/controller/drivingDynamics/actuators/electronicDiffLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/vehicle/electricsCustomValueParser.lua
-- -- --if it's not in either table, it's forbidden and we abort parsing
-- s = s:sub(1, (s:find("%.") or (s:len() + 1)) - 1)
-- if not (customElectricsEnv[s] or keyworkdWhiteListLookup[s]) then
@/lua/vehicle/controller/gauges/analogOdometer.lua
for k, v in pairs(jbeamData) do
if k:sub(1, #"configuration_") == "configuration_" then
tableMergeRecursive(configData, v)
@/lua/ge/extensions/util/trackBuilder/splineTrack.lua
local _, fn, e = path.split(file)
local name = fn:sub(1, #fn - #e - 1)
local read = loadJSON(name)
local _, fn, e = path.split(file)
previews[i] = fn:sub(1, #fn - #e - 1)
end
local _, fn, e = path.split(file)
previews[i] = fn:sub(1, #fn - #e - 1)
end
@/lua/vehicle/extensions/core/quickAccess.lua
end
if string.sub(args.level, string.len(args.level)) ~= "/" then
args.level = args.level .. "/"
@/lua/ge/extensions/editor/particleEditor.lua
if particleDataName then
stringList = stringList:sub(last+1)
local particleData = scenetree.findObject(particleDataName)
if particleDataName then
stringList = stringList:sub(last+1)
else
local first, last, _ = string.find(particles, "(" .. particle:getName() .. ")")
local newParticles = string.sub(particles, 1, first-1)
newParticles = newParticles .. string.sub(particles, last+1)
local newParticles = string.sub(particles, 1, first-1)
newParticles = newParticles .. string.sub(particles, last+1)
newParticles = cleanTabs(newParticles)
@/lua/vehicle/controller/drivingDynamics/actuators/activeDiffLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/ge/extensions/core/modmanager.lua
if string.startswith(path, "/vehicles/") and not string.startswith(path, "/vehicles/mod_info") then
vehicles[string.sub(path, 20)] = 1
end
local tmp = e:gsub(filename, "")
if tmp:sub(1,1) ~= "/" then tmp = "/"..tmp end
filesInZIP[#filesInZIP+1] = tmp
local needManualAction = true
if string.sub(oldFilepath,1,11) == "/mods/repo/" then
zip:close()
local path, filename, ext = path.split(v)
local infofile = path .. string.sub(filename, 0, -string.len(ext)-2) .. '.json'
local data = jsonReadFile(infofile)
local tmp = e:gsub(mods[modname].unpackedPath, "")
if tmp:sub(1,1) ~= "/" then tmp = "/"..tmp end
mountedFilesChange[i] = {filename = tmp, type = reason }
if zipPath:startswith(mods[modname].unpackedPath) then
zipPath = string.sub(zipPath, string.len(mods[modname].unpackedPath) + 1)
if string.startswith(zipPath, '/') then
if string.startswith(zipPath, '/') then
zipPath = string.sub(zipPath, 2)
end
if string.startswith(realPath, userPath) then
local modPath = realPath:sub(string.len(userPath))
modPath = modPath:gsub("\\", "/")
if zipPos then
modPath = modPath:sub(1, zipPos + 3)
else
@/lua/vehicle/extensions/inputAnalyzer.lua
if inputLength >= is.stringLength then
local subStr = inputString:sub(inputLength - is.stringLength + 1)
if subStr == is.string then
if inputLength > 16 then
inputString = inputString:sub(2)
end
@/lua/ge/extensions/editor/masterSpline/splineMgr.lua
local baseName = decalSpline.name or "Decal Spline"
local uniqueName = baseName .. " - " .. string.sub(spline.id, 1, 8)
setNameJumpTable[decalSplineLink.getToolPrefixStr()](spline.id, uniqueName)
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamModifierLeakVis.lua
-- is it a node material?
if valuePart:sub(1,3) == "NM_" then
ival = particles.getMaterialIDByName(materials, valuePart:sub(4))
if valuePart:sub(1,3) == "NM_" then
ival = particles.getMaterialIDByName(materials, valuePart:sub(4))
--log('D', "jbeam.replaceSpecialValues", "replaced "..valuePart.." with "..ival)
elseif sectionName:match('^scale') and type(section) == "number" then
modsScalers[sectionName:sub(6, #sectionName)] = {modVal = section, partPath = partName}
end
@/lua/ge/extensions/gameplay/rally/notebook/pacenote.lua
if note_field_freeform ~= rallyUtil.autofill_blocker then
local last_char = note_field_freeform:sub(-1)
if note_field_freeform == '' then
-- Get the last character of the note
local lastChar = note:sub(-1)
if rallyUtil.hasPunctuation(lastChar) then
note = string.sub(note, 1, -2)
lastChar = note:sub(-1)
note = string.sub(note, 1, -2)
lastChar = note:sub(-1)
end
@/lua/common/json-ast.lua
while true do
c = ctx.str:sub(ctx.pos, ctx.pos)
if c ~= chr or not c or c == '' then
while true do
c = ctx.str:sub(ctx.pos, ctx.pos)
ctx.pos = ctx.pos + 1
}
if num_str:sub(1, 1) == '+' then
node.prefixPlus = true
end
node.addPostfixDot = num_str:sub(num_len, num_len) == '.'
_addNode(ctx, node)
while true do
c = ctx.str:sub(ctx.pos, ctx.pos)
ctx.pos = ctx.pos + 1
end
local nextChar = ctx.str:sub(ctx.pos, ctx.pos)
if c == '\n' then
while true do
c = ctx.str:sub(ctx.pos, ctx.pos)
ctx.pos = ctx.pos + 1
end
if c == '*' and ctx.str:sub(ctx.pos, ctx.pos) == '/' then
ctx.pos = ctx.pos + 1
local chr = ctx.str:sub(ctx.pos, ctx.pos)
local posSaved = ctx.pos
ctx.pos = ctx.pos + 1
elseif chr == 't' and ctx.str:sub(ctx.pos, ctx.pos + 3) == 'true' then
_addNode(ctx, {'bool', true})
ctx.pos = ctx.pos + 4
elseif chr == 'f' and ctx.str:sub(ctx.pos, ctx.pos + 4) == 'false' then
_addNode(ctx, {'bool', false})
ctx.pos = ctx.pos + 1
elseif chr == '\r' and ctx.str:sub(ctx.pos + 1, ctx.pos + 1) == '\n' then
_addNode(ctx, {'newline_windows'})
ctx.pos = ctx.pos + 1
elseif chr == '/' and ctx.str:sub(ctx.pos + 1, ctx.pos + 1) == '/' then
_parse_comment(ctx)
_parse_comment(ctx)
elseif chr == '/' and ctx.str:sub(ctx.pos + 1, ctx.pos + 1) == '*' then
_parse_comment_multiline(ctx)
@/lua/ge/extensions/flowgraph/nodes/activity/activityFlow.lua
im.Text("Activity: "..(self.mgr.activity and "yes" or "no"))
im.TextColored(self.mgr.activity and colorEnabled or colorDisabled, self.mgr.activity and ("..."..self.mgr.activity.id:sub(-15)) or "(standalone)")
end
@/lua/vehicle/extensions/tech/CANBus/ProjectBavariaShifter.lua
local function applyInputs(leverState, parkButtonState)
local gear = string.sub(electrics.values.gear or "", 1, 1)
local function updateHardwareState(dt)
local state = gearStateLookup[string.sub(electrics.values.gear or "", 1, 1)] or 0
if electrics.values.ignitionLevel <= 0 then
@/lua/ge/extensions/ui/vehicleSelector/vehicleSpecifications.lua
local start = math.max(1, i - 2)
table.insert(parts, 1, integerPart:sub(start, i))
end
@/lua/ge/extensions/tech/techCore.lua
sourceFile = fgMgr.savedDir .. name .. '.json'
if string.sub(sourceFile, 1, 1) ~= '/' then
sourceFile = '/' .. sourceFile
@/lua/ge/extensions/core/vehicle/partmgmt.lua
end
elseif dataType == 'string' and configData:sub(1, 1) == '{' then
local res, newConfigData = preprocessPartConfig(deserialize(configData))
-- notify the vehicle selector that the vehicle has been saved and clear the cache
local configWithoutFilename = string.sub(filename, #(playerVehicleData.vehicleDirectory or "") + 1)
configWithoutFilename = configWithoutFilename:gsub("%.pc$", "")
for _, file in pairs(files) do
local basename = string.sub(file, string.len(playerVehicle.vehicleDirectory) + 1, -1)
table.insert(result,
fileName = basename,
name = string.sub(basename,0, -4),
official = isOfficialConfig(basename),
@/lua/common/libs/lunajson/lunajson/sax.lua
local function f_nul()
if sub(json, pos, pos+2) == 'ull' then
pos = pos+3
local function f_fls()
if sub(json, pos, pos+3) == 'alse' then
pos = pos+4
local function f_tru()
if sub(json, pos, pos+2) == 'rue' then
pos = pos+3
end
str = str .. sub(json, pos, jsonlen)
if pos2 == jsonlen+2 then
end
str = str .. sub(json, pos, newpos-1)
pos = newpos+1
local pos2 = (pos-1) + n
local str = sub(json, pos, pos2)
while pos2 > jsonlen and jsonlen ~= 0 do
pos2 = pos2 - (jsonlen - (pos-1))
str = str .. sub(json, pos, pos2)
end
@/lua/vehicle/extensions/gameplayInterface.lua
local _, file, _ = path.split(filePath)
local fileName = file:sub(1, -5)
local extensionPath = "gameplayInterfaceModules/" .. fileName
@/lua/common/csvlib.lua
for i = 1, headercount do
header[i] = #header[i] > 0 and tostring(header[i]):sub(1, 1) or "_"
end
filename = filename or self.headernym or format
if filename:sub(-4, -4) ~= '.' then
filename = string.format("%s_%s.%s", filename, os.date("%Y-%m-%dT%H_%M_%S"), format)
until (c == 34 and byte(s, i+1) ~= 34) or c == nil -- "
val = sub(s, si+1, i - 1):gsub('""', '"')
repeat i=i+1; c = byte(s,i) until c~=32 and c~=9 -- space tab
end
val = sub(s, si, i - 1)
if testnum then val = tonumber(val) or val end
@/lua/vehicle/ai.lua
return laneConfig:sub(1, leftIdx-1), laneConfig:sub(leftIdx, rightIdx), laneConfig:sub(rightIdx+1, numOfLanes)
end
return laneConfig:sub(1, leftIdx-1), laneConfig:sub(leftIdx, rightIdx), laneConfig:sub(rightIdx+1, numOfLanes)
end
return laneConfig:sub(1, leftIdx-1), laneConfig:sub(leftIdx, rightIdx), laneConfig:sub(rightIdx+1, numOfLanes)
end
local i = string.find(k, '\0')
local n1id = string.sub(k, 1, i-1)
local sqDist = positions[n1id]:squaredDistance(ego.pos)
target = n1id
targetLink = string.sub(k, i+1, #k)
end
@/lua/ge/extensions/editor/materialEditor.lua
local filepath = currentMaterial:getField(k, i)
if tmp ~= "" and string.sub(filepath, 1, 1) ~= '/' then
filepath = "/"..filepath
@/lua/ge/extensions/freeroam/bigMapMode.lua
if not mission then
mission = gameplay_missions_missions.getMissionById(string.sub(missionId, 1, -3))
end
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/scriptAI/pathFromFile.lua
for _, fileName in pairs(self.files) do
local fnShort = string.sub(fileName, string.len(trackFilePath) + 1)
fnShort = string.sub(fnShort, 1, string.len(fnShort) - string.len(trackFileExt))
local fnShort = string.sub(fileName, string.len(trackFilePath) + 1)
fnShort = string.sub(fnShort, 1, string.len(fnShort) - string.len(trackFileExt))
if im.Selectable1(fnShort, fnShort==self.fnShort) then
if self.fileName and self.fileName ~= "" then
local fnShort = string.sub(self.fileName, string.len(trackFilePath) + 1)
self.fnShort = string.sub(fnShort, 1, string.len(fnShort) - string.len(trackFileExt))
local fnShort = string.sub(self.fileName, string.len(trackFilePath) + 1)
self.fnShort = string.sub(fnShort, 1, string.len(fnShort) - string.len(trackFileExt))
end
@/lua/common/libs/LuLPeg/lulpeg.lua
local function patt_error (s, i)
local msg = (#s < i + 20) and s:sub(i)
or s:sub(i,i+20) .. "..."
local msg = (#s < i + 20) and s:sub(i)
or s:sub(i,i+20) .. "..."
msg = ("pattern error near '%s'"):format(msg)
local e = #c + i
if s:sub(i, e - 1) == c then return e else return nil end
end
@/lua/vehicle/controller/vehicleController/shiftLogic/automaticGearbox.lua
modePrefix = "S"
elseif string.sub(automaticHandling.mode, 1, 1) == "M" then
modePrefix = "M"
local manualModeIndex
if string.sub(automaticHandling.mode, 1, 1) == "M" then
manualModeIndex = string.sub(automaticHandling.mode, 2)
if string.sub(automaticHandling.mode, 1, 1) == "M" then
manualModeIndex = string.sub(automaticHandling.mode, 2)
end
M.isSportModeActive = automaticHandling.mode == "S"
M.isManualModeActive = string.sub(automaticHandling.mode, 1, 1) == "M"
end
automaticHandling.defaultForwardMode = mode
if automaticHandling.mode == "D" or automaticHandling.mode == "S" or tonumber(automaticHandling.mode) or string.sub(automaticHandling.mode, 1, 1) == "M" then
if mode == "M1" then --we just shifted into M1
if string.find(automaticHandling.mode, "M") then
local gearIndex = tonumber(string.sub(automaticHandling.mode, 2))
gearRatio = gearbox.gearRatios[gearIndex]
if string.find(automaticHandling.mode, "M") then
local gearIndex = tonumber(string.sub(automaticHandling.mode, 2))
gearRatio = gearbox.gearRatios[gearIndex]
local gearChangeTime = min(max(automaticHandling.gearChangeTimeRange * (M.smoothedValues.drivingAggression - 0.5) * 2 + automaticHandling.maxGearChangeTime, automaticHandling.minGearChangeTime), automaticHandling.maxGearChangeTime)
local autoMode = string.sub(automaticHandling.mode, 1, 1)
if (autoMode == "S" or autoMode == "M") then
local gearboxInputAV = gearbox.inputAV
local isManualMode = string.sub(automaticHandling.mode, 1, 1) == "M"
for i = 1, modeCount do
local mode = modes:sub(i, i)
if automaticHandling.availableModeLookup[mode] then
@/lua/ge/extensions/editor/roadNetworkExporter.lua
local filename = data.filepath
extensions.tech_openDriveExporter.export(filename:sub(1, -(#".xodr" + 1)))
exportedFilename = FS:virtual2Native(filename)
local filename = data.filepath
extensions.tech_openStreetMapExporter.export(filename:sub(1, -(#".osm" + 1)))
osmExportedFilename = FS:virtual2Native(filename)
sumo_filename = filename
extensions.tech_sumoExporter.export(sumo_filename:sub(1, -(#".xml" + 1)))
sumoExportedFilename = FS:virtual2Native(sumo_filename)
@/lua/vehicle/input.lua
--print(string.format("/ Splitting '%10s' into long: '%5s', side: '%5s' .", wheelName, long, side))
long = long and long:sub(1, 1) or long
side = side and side:sub(1, 1) or side
long = long and long:sub(1, 1) or long
side = side and side:sub(1, 1) or side
--print(string.format("\\_ Splitting '%10s' into long: '%5s', side: '%5s' .", wheelName, long, side))
@/ui/ui-vue/dist/index.js
`,_sfc_main$70={__name:`OthersView`,props:{addons:Object},emits:[`changeView`],setup(__props,{emit:__emit}){let{lua}=useBridge(),emit$1=__emit,inGarage=sysInfo_default.gameState.value===`garage`,navigate$1=(...state)=>{let stateName=state[0];window.bngVue.gotoGameState(stateName,{params:{mode:`mainMenuOthers`},tryAngularJS:!0,blankAngularJS:!0})},startGarage=()=>lua.extensions.gameplay_garageMode.start(),startTrackBuilder=()=>lua.freeroam_freeroam.startTrackBuilder(`glow_city`);async function rallyDisclaimer(){await openExperimental($translate.instant(`ui.rally.experimentalTitle`),htmlBody,[{label:$translate.instant(`ui.common.back`),value:!1,isCancel:!0,extras:{accent:ACCENTS.secondary}},{label:$translate.instant(`ui.common.understood`),value:!0,default:!0}])&&openGameplaySelector(`openRallySelector`)}function runAction(action){switch(typeof action){case`function`:nextTick(action);break;case`string`:navigate$1(action);break;case`object`:Array.isArray(action)?navigate$1(...action):navigate$1(action.state,action.params);break}}function openGameplaySelector(action){lua.ui_gameplaySelector_general[action]()}return(_ctx,_cache)=>(openBlock(),createElementBlock(`div`,_hoisted_1$62,[createBaseVNode(`div`,_hoisted_2$51,[createVNode(unref(bngScreenHeading_default),{class:`header`,divider:!0,type:`line`},{default:withCtx(()=>[..._cache[13]||=[createTextVNode(` More `,-1)]]),_:1}),createBaseVNode(`div`,_hoisted_3$44,[createVNode(BackAside_default,{onClick:_cache[0]||=$event=>emit$1(`changeView`,null)}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`rallyHelmet`,onClick:_cache[1]||=$event=>rallyDisclaimer(),tag:_ctx.$t(`ui.career.experimental.name`),"tag-red":``},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.rally`)),1)]),_:1},8,[`tag`]),createVNode(MenuButton_default,{size:`medium`,"icon-id":`gamepad`,tag:`New!`,onClick:_cache[2]||=$event=>openGameplaySelector(`openGameplaySelector`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`Gameplay Selector`)),1)]),_:1}),createVNode(MenuButton_default,{"bng-scoped-nav-autofocus":``,size:`medium`,"icon-id":`flag`,tag:`Gameplay Filter`,onClick:_cache[3]||=$event=>openGameplaySelector(`openChallengesSelector`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.options.userInterface.showMissionMarkers`)),1)]),_:1}),createVNode(MenuButton_default,{"bng-scoped-nav-autofocus":``,size:`medium`,"icon-id":`star`,tag:`Gameplay Filter`,onClick:_cache[4]||=$event=>openGameplaySelector(`openCampaignsSelector`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.campaigns`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`clapperboard`,tag:`Gameplay Filter`,onClick:_cache[5]||=$event=>openGameplaySelector(`openScenariosSelector`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.scenarios`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`stopwatchArrows02`,onClick:_cache[6]||=$event=>navigate$1(`menu.quickraceOverview`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.quickrace`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,disabled:inGarage,highlighted:inGarage,"icon-id":`carDealer`,onClick:_cache[7]||=$event=>startGarage()},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.mainmenu.garage`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`bus`,onClick:_cache[8]||=$event=>navigate$1(`menu.busRoutes`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.bus`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`lightrunner`,onClick:_cache[9]||=$event=>navigate$1(`menu.lightrunnerOverview`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.lightRunner`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,disabled:inGarage,"icon-id":`autobahn`,onClick:_cache[10]||=$event=>startTrackBuilder()},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.playmodes.trackBuilder`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`movieCamera`,onClick:_cache[11]||=$event=>navigate$1(`menu.replay`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.dashboard.replay`)),1)]),_:1}),createVNode(MenuButton_default,{size:`medium`,"icon-id":`chartBars`,onClick:_cache[12]||=$event=>navigate$1(`menu.options.stats`)},{default:withCtx(()=>[createTextVNode(toDisplayString(_ctx.$tt(`ui.statspage.title`)),1)]),_:1}),(openBlock(!0),createElementBlock(Fragment,null,renderList(__props.addons,(item,idx)=>(openBlock(),createBlock(MenuButton_default,{key:idx,size:`medium`,"icon-id":item.iconId,icon:item.icon,onClick:$event=>runAction(item.action),tag:_ctx.$t(`ui.mainmenu.mod`),"tag-dark-green":``},{default:withCtx(()=>[createTextVNode(toDisplayString(item.title),1)]),_:2},1032,[`icon-id`,`icon`,`onClick`,`tag`]))),128))])])]))}},OthersView_default=__plugin_vue_export_helper_default(_sfc_main$70,[[`__scopeId`,`data-v-4c4dfed6`]]),Storage=class{constructor(name,values={}){this.storage=window.localStorage,this.name=name,this.assign(values)}assign(values={}){this._values||(this._values={},this.values=reactive({}));let keys=Object.keys(values);for(let key in this._values)delete this.values[key];if(this._values={},keys.length===0){this._listener&&=(window.removeEventListener(`storage`,this._listener),null);return}let that=this;for(let key in values)this._values[key]={exists:this.has(key),value:this.get(key,values[key]),defaultValue:values[key]},Object.defineProperty(this.values,key,{get(){let item=that._values[key];return item.exists?item.value:that.evalDefaultValue(item.defaultValue)},set(value){let item=that._values[key];value!==item.value&&(item.exists=!0,item.value=value,that.set(key,value))},enumerable:!0,configurable:!0});this._listener||(this._listener=()=>{for(let key in this._values){let item=this._values[key],newExists=that.has(key),newValue=that.get(key,item.defaultValue);(item.exists!==newExists||item.value!==newValue)&&(item.exists=newExists,item.value=newValue,that.values[key]=newValue)}},window.addEventListener(`storage`,this._listener))}evalDefaultValue(defaultValue){return typeof defaultValue==`function`?defaultValue():defaultValue}getKey(key){return this.name+`:`+key}has(key){return this.storage.getItem(this.getKey(key))!==null}get(key,defaultValue=void 0){let data=this.storage.getItem(this.getKey(key));try{return data===null?this.evalDefaultValue(defaultValue):JSON.parse(data)}catch(error){return console.warn(`Error parsing storage data for key: ${key}\n`,error),this.evalDefaultValue(defaultValue)}}set(key,value){let data=JSON.stringify(value);this.storage.setItem(this.getKey(key),data)}del(key){this.storage.removeItem(this.getKey(key))}};const useDiscoverStore=defineStore(`discover`,()=>{let{lua,events:events$3}=useBridge(),discoverPages=ref([]),loaded=ref(!1),enabled=ref(!1),descShow=ref(!1),descText=ref(null),descriptions=ref({hover:null,focus:null}),pageDescription=ref(null),currentPage=ref(0),descTimer=null,storage=new Storage(`discover`,{lastSelected:0,lastStarted:void 0}).values;function setDescription(type,card=void 0){descTimer&&clearTimeout(descTimer),descriptions.value[type]=card?.description,card?(descShow.value=!0,descText.value=card.description):type===`hover`&&descriptions.value.focus?descText.value=descriptions.value.focus:descTimer=setTimeout(()=>{descShow.value=!1,descTimer=setTimeout(()=>{descText.value=null,descTimer=null},200)},100)}async function loadDiscoverPages(){loaded.value=!1,enabled.value=!1,discoverPages.value=[],await lua.extensions.load(`gameplay_discover`),discoverPages.value=await lua.gameplay_discover.getDiscoverPages(),loaded.value=!0,enabled.value=!0,console.log(`discoverPages`,discoverPages.value,`lastStartedDiscoverId`,storage.lastStarted)}async function startDiscover(discoverId){let cardIndex=allCards.value.findIndex(card=>card.discoverId===discoverId);if(cardIndex===-1){console.warn(`startDiscover: card not found: ${discoverId}`);return}storage.lastSelected=cardIndex,storage.lastStarted=discoverId,enabled.value=!1,events$3.emit(`LoadingScreen`,{active:!0}),await startLoading$1(async()=>{await waitForLoadingScreenFadeIn$1(),await lua.gameplay_discover.startDiscover(discoverId)})}let sections=computed(()=>{let baseSections=[],stamp=Date.now();if(discoverPages.value&&Array.isArray(discoverPages.value)&&discoverPages.value.length>0){let page=discoverPages.value[currentPage.value];if(page&&page.sections){for(let section of page.sections)if(section.cards&§ion.cards.length>0){let isFreeroam=section.type===`freeroam`,sectionConfig={title:section.title||(isFreeroam?`Freeroam Experiences`:`Showcase Challenges`),cards:[],placeholders:isFreeroam?5:10,size:isFreeroam?`big`:`medium`,style:isFreeroam?{}:{"--button-height":`4.5em`},key:stamp++,type:section.type};for(let card of section.cards){let cardWithHandlers={...card,onClick:()=>startDiscover(card.discoverId),onFocus:()=>setDescription(`focus`,card),onHover:()=>setDescription(`hover`,card),onBlur:()=>setDescription(`focus`),onMouseLeave:()=>setDescription(`hover`)};sectionConfig.cards.push(cardWithHandlers)}baseSections.push(sectionConfig)}}}return baseSections}),allCards=computed(()=>sections.value.flatMap(s=>s.cards)),description=computed(()=>({show:descShow.value,text:descText.value})),lastSelectedIndex=computed({get:()=>storage.lastSelected,set:value=>storage.lastSelected=value}),lastStartedDiscoverId=computed(()=>{if(storage.lastStarted)return storage.lastStarted;for(let section of sections.value)if(section.cards.length>0)return section.cards[0].discoverId}),totalPages=computed(()=>discoverPages.value?.length||0),hasNextPage=computed(()=>currentPage.value