sub
Definition
-- @/=[C]:-1
function sub(...)
Callers
@/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/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/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/ge/extensions/campaign/campaignsLoader.lua
campaign.previews = {
imageExistsDefault(campaign.sourcePath..'/'..campaign.sourcePath:sub(index)..'.jpg')
}
@/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/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/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/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/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/vehicle/protocols.lua
local filename = filepath:match("[^/]*.lua$")
local name = filename:sub(0, #filename - 4)
local enabled = false
@/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/ui/uiMods.lua
end
local relPath = filepath:sub(#modDir + #modname + 2)
table.insert(mods[modname].files, relPath)
@/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/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/telemetry/core.lua
-- Validate event name format: must start with lowercase and be camelCase
local firstChar = event.name:sub(1, 1)
if firstChar:upper() == firstChar then
@/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/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/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/core/commandhandler.lua
if arg1:startswith('beamng:') then
onSchemeCommand(arg1:sub(8), true) -- strip 'beamng:'
break
@/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/editor/sidewalkSpline/kit.lua
local anchorName = anchorNames[i]
if anchorName:sub(1, 9) == anchorPrefixStrWithDot then
table.clear(tmpParts) -- Clear the reusable table.
@/lua/common/json.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/raceEditor.lua
table.insert(allFiles,{
name = string.sub(filename,1,-11),
file = f
@/lua/ge/extensions/editor/scriptAIManager.lua
local fn_short = string.sub(filename, string.len(trackFilePath) + 1)
fn_short = string.sub(fn_short, 1, string.len(fn_short) - string.len(trackFileExt))
local fn_short = string.sub(filename, string.len(trackFilePath) + 1)
fn_short = string.sub(fn_short, 1, string.len(fn_short) - string.len(trackFileExt))
if im.Button(fn_short) then
@/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/vehicle/extensions/tech/CANBus/ProjectBavariaKombi.lua
local state = gearStateLookup[string.sub(electrics.values.gear or "", 1, 1)] or 0
if electrics.values.ignitionLevel <= 0 then
@/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/vehicle/controller/vehicleController/shiftLogic/cvtGearbox2.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
for i = 1, modeCount do
local mode = modes:sub(i, i)
if automaticHandling.availableModeLookup[mode] then
@/lua/ge/extensions/core/schemeCommandServer.lua
if string.startswith(data, 'beamng:') then
commandhandler.onSchemeCommand(data:sub(8))
end
@/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/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
@/flowgraphEditor/Tower/customNodes/towerNode.lua
local _, fn, ext = path.split(room.file, true)
local name = generateObjectNameForClass('Prefab', string.format("%s - %d - ", string.sub(fn, 1, string.len(fn) - string.len(ext)-1), i))
local scenetreeObject = spawnPrefab(name , self.mgr.savedDir .. room.file, "0 0 0", "0 0 1 0", "1 1 1", false)
@/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/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/core/remoteController.lua
--log('D', logTag, "got '" .. tostring(data) .. "' from "..tostring(ip) .. ":" .. tostring(listenPort))
if(data:sub(0, 6) == 'beamng') then -- new device trying to connect
local args = split(data, '|')
@/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/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/vehicle/controller/propAnimation/dualAxisLever.lua
local function handleMSModes(desiredMode)
local firstLetter = desiredMode:sub(1, 1)
if firstLetter == "S" then
elseif firstLetter == "M" then
local gearIndex = desiredMode:sub(2, desiredMode:len())
desiredMode = "M"
--get the base this mode relates to
local modeBaseName = impulseMode.modeName:sub(1, modeNameLength - 1)
--we need to actually have the base mode for this to work
@/lua/ge/extensions/flowgraph/nodes/mission/getCustomVehicleData.lua
while s <= #str do
while str:sub(e, e) ~= "," and e <= #str do
e = e + 1
end
wps[i] = str:sub(s, e - 1)
e = e + 1
@/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/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/ge/extensions/gameplay/missions/progress.lua
for _, file in ipairs(files) do
local aConds = require(file:sub(0, -5))
@/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/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/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/core/input/actions.lua
if string.startswith(actionName, prefix) then
actionName = string.sub(actionName, 1+string.len(prefix))
else
@/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/util/nodeBeamExport.lua
local dir = vdata.vehicleDirectory
if string.sub(dir, -1) ~= '/' then dir = dir .. '/' end
@/lua/common/jbeam/expressionParser.lua
__index = function(tbl, key)
local val = varWrapper.vars['$' .. key:sub(5)]
if type(val) == "table" then return val.val else return val end
--strip leading "$=" from expression and replace all occurences of "$" with "_" (as these are used for lua variable names)
expr = expr:sub(3):gsub('%$', 'var_')
--strip leading "$=" from expression and replace all occurences of "$" with "_" (as these are used for lua variable names)
expr = expr:sub(3):gsub('%$', 'var_')
__index = function(tbl, key)
local val = varWrapper.vars['$' .. key:sub(5)]
if type(val) == "table" then return val.val else return val end
--strip leading "$=" from expression and replace all occurences of "$" with "_" (as these are used for lua variable names)
expr = expr:sub(3):gsub('%$', 'var_')
@/lua/ge/extensions/gameplay/missions/unlocks.lua
for _, file in ipairs(files) do
local aConds = require(file:sub(0,-5))
@/lua/ge/extensions/editor/dynamicDecals/brushes.lua
local dir, fileName, fileExt = path.split(decalColorTexturePath)
name = string.sub(fileName, 1, #fileName - (#fileExt + 1))
end
@/lua/ge/extensions/gameplay/sites/sitesManager.lua
local _, siteName = path.split(site)
if name == string.sub(siteName, 0, -12) then
return site
@/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/ge/extensions/career/modules/playerAttributes.lua
if attributeName:endswith("Reputation") then
local orgId = attributeName:sub(1, -11)
career_career.interactWithOrganization(orgId)
@/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/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/ge/extensions/gameplay/drift/saveLoad.lua
local dir, _, _ = path.split(file)
local spotId = level .."/".. string.sub(dir, #levelSpotsDir+1, -2)
-- main data
@/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/ui/console.lua
if tostring(slashed[1]):len() > 4096 then
logs[logsTail] = {t,lvl,origin,tostring(slashed[1]):sub(1,4096)} --trim so we save memory and don't stress other part of code
else
if tostring(slashed[i]):len() > 4096 then
logs[logsTail] = {t,lvl,origin,tostring(slashed[i]):sub(1,4096)} --trim so we save memory and don't stress other part of code
else
if v ~= 2 and im.GetContentRegionAvailWidth() < txtwidth then
im.TextColored(lcol,string.format("%s", tostring(v):sub(1,256) ))
txtwidth = txtwidth * (1/fontConsoleFact[0])
while(bt:len() > chunkSize and chunk:len() < 2048) do
chunk = chunk..bt:sub(1,chunkSize).."\n"
bt = bt:sub(chunkSize+1)
chunk = chunk..bt:sub(1,chunkSize).."\n"
bt = bt:sub(chunkSize+1)
end
--table.insert(console_log_buffer, {'r', tostring(res)})
if type(res)=="string" and res:sub(1,7)== "Error: " then
log("E", "exec", res)
strI = strI..", "..vobj:getJBeamFilename()
if vobj.partConfig:sub(1,1) == "{" or vobj.partConfig:sub(1,1) == "[" then
strI = strI..", *custom*"
strI = strI..", "..vobj:getJBeamFilename()
if vobj.partConfig:sub(1,1) == "{" or vobj.partConfig:sub(1,1) == "[" then
strI = strI..", *custom*"
@/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/vehicle/controller/vehicleController/shiftLogic/electricMotor.lua
for i = 1, modeCount do
local mode = modes:sub(i, i)
if automaticHandling.availableModeLookup[mode] 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/fileDialog.lua
fileCache = {}
if currentPath:sub(1,1) ~= "/" then currentPath = "/" .. currentPath end
if currentPath:sub(-1) ~= "/" then currentPath = currentPath.."/" end
if currentPath:sub(1,1) ~= "/" then currentPath = "/" .. currentPath end
if currentPath:sub(-1) ~= "/" then currentPath = currentPath.."/" end
currentPath = currentPath:gsub("/+", "/") -- Reducing multiple slashes to avoid trimmed list names
local s = FS:stat(fn)
s.name = string.sub(fn, pathLen)
s.name = string.gsub(s.name, "/(.*)", "%1") -- strip leading /
if lastSep then
parentFolder = currentPath:sub(1, currentPath:len()-lastSep+1 )
end
@/lua/ge/extensions/editor/api/dynamicDecals.lua
local rdnNumber = math.random(1, #randomStringChars)
res = res .. string.sub(randomStringChars, rdnNumber, rdnNumber)
end
local _, filename, extension = path.split(layerData.decalColorTexturePath)
colorMapTextureString = string.sub(filename, 1, #filename - (#extension + 1))
elseif layerData.type == M.layerTypes.textureFill then
if filename ~= "" then
colorMapTextureString = string.sub(filename, 1, #filename - (#extension + 1))
end
if filename ~= "" then
normalMapTextureString = string.sub(filename, 1, #filename - (#extension + 1))
end
if filename ~= "" then
metallicMapTextureString = string.sub(filename, 1, #filename - (#extension + 1))
end
if filename ~= "" then
roughnessMapTextureString = string.sub(filename, 1, #filename - (#extension + 1))
end
if filename ~= "" then
alphaMapTextureString = string.sub(filename, 1, #filename - (#extension + 1))
end
@/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/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/ge/extensions/editor/assemblySpline/molecule.lua
for _, anchorName in ipairs(anchorNames) do
if anchorName:sub(1, 5) == anchorPrefixStrWithDot then
local parts = {}
@/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/editor/undoHistory.lua
for s in actionData:gmatch("[^\n]+") do
table.insert(lines, s:sub(1, toolTipMaxWidth)) -- limit width
end
@/lua/common/libs/StackTracePlus/StackTracePlus.lua
--print("guessing function name")
if type(info.source) == "string" and info.source:sub(1,1) == "@" then
local file, err = io_open(info.source:sub(2), "r")
if type(info.source) == "string" and info.source:sub(1,1) == "@" then
local file, err = io_open(info.source:sub(2), "r")
if not file then
if _M.max_string_output_len > 0 and stringlen > _M.max_string_output_len then
self:add_f("%s%s = string[%d/%d]: %q (more...)\n", prefix, name, _M.max_string_output_len, stringlen, string.sub(tostring(value), 1, _M.max_string_output_len))
else
local source = info.source
if source:sub(2,7) == "string" then
source = source:sub(9) -- uno m�s, por el espacio que viene (string "Baragent.Main", por ejemplo)
if source:sub(2,7) == "string" then
source = source:sub(9) -- uno m�s, por el espacio que viene (string "Baragent.Main", por ejemplo)
end
local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name
if source:sub(2, 7) == "string" then
source = source:sub(9)
if source:sub(2, 7) == "string" then
source = source:sub(9)
end
local function_type = (info.namewhat == "") and "function" or info.namewhat
if info.source and info.source:sub(1, 1) == "@" then
dumper:add_f("\n(%d) %s:%d %s (%s)", level_to_show, info.source:sub(2), info.currentline, function_name, function_type)
if info.source and info.source:sub(1, 1) == "@" then
dumper:add_f("\n(%d) %s:%d %s (%s)", level_to_show, info.source:sub(2), info.currentline, function_name, function_type)
elseif info.source and info.source:sub(1,1) == '#' then
dumper:add_f("\n(%d) %s:%d %s (%s)", level_to_show, info.source:sub(2), info.currentline, function_name, function_type)
elseif info.source and info.source:sub(1,1) == '#' then
dumper:add_f("\n(%d) Lua %s '%s' at template '%s:%d'%s", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
elseif info.source and info.source:sub(1,1) == '#' then
dumper:add_f("\n(%d) Lua %s '%s' at template '%s:%d'%s", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
else
else
dumper:add_f("\n(%d) %s:%d: %s", level_to_show, source:sub(2, -3), info.currentline, function_name)
end
local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name
if source:sub(2, 7) == "string" then
source = source:sub(9)
if source:sub(2, 7) == "string" then
source = source:sub(9)
end
local function_type = (info.namewhat == "") and "function" or info.namewhat
if info.source and info.source:sub(1, 1) == "@" then
dumper:add_f("(%d) Lua %s '%s' at file '%s:%d'%s\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
if info.source and info.source:sub(1, 1) == "@" then
dumper:add_f("(%d) Lua %s '%s' at file '%s:%d'%s\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
elseif info.source and info.source:sub(1,1) == '#' then
dumper:add_f("(%d) Lua %s '%s' at file '%s:%d'%s\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
elseif info.source and info.source:sub(1,1) == '#' then
dumper:add_f("(%d) Lua %s '%s' at template '%s:%d'%s\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
elseif info.source and info.source:sub(1,1) == '#' then
dumper:add_f("(%d) Lua %s '%s' at template '%s:%d'%s\n", level_to_show, function_type, function_name, info.source:sub(2), info.currentline, was_guessed and " (best guess)" or "")
else
@/lua/vehicle/controller/gauges/genericGauges.lua
for k, v in pairs(jbeamData) do
if k:sub(1, #"configuration_") == "configuration_" then
tableMergeRecursive(configData, v)
@/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/editor/preferences.lua
if string.len(defVal) > 100 then
defVal = string.sub(defVal, 1, 100) .. "..."
end
@/lua/ge/extensions/tech/techCore.lua
sourceFile = fgMgr.savedDir .. name .. '.json'
if string.sub(sourceFile, 1, 1) ~= '/' then
sourceFile = '/' .. sourceFile
@/lua/ge/extensions/career/branches.lua
local infoDir, _, _ = path.split(filePath)
branch.dir = string.sub(infoDir, 1, -1) -- Remove trailing '/'
branch.id = ""
local folders = {'domains'}
for folder in string.gmatch(string.sub(infoDir, #branchesDir, -2), "[^/]+") do
table.insert(folders, folder)
local folders = {'domains'}
for folder in string.gmatch(string.sub(infoDir, #branchesDir, -2), "[^/]+") do
table.insert(folders, folder)
@/lua/vehicle/extensions/gameplayInterface.lua
local _, file, _ = path.split(filePath)
local fileName = file:sub(1, -5)
local extensionPath = "gameplayInterfaceModules/" .. fileName
@/lua/ge/extensions/editor/gen/mesh.lua
-- lo('?? for_INST:'..tostring(k.parent.attr.name))
local s = string.sub(k.attr.url,2)
if dgeo[s] then
-- U.dump(k.attr,'?? for_ATTR:'..tostring(k.attr.semantic))
dsem[k.attr['source']:sub(2)] = k.attr.semantic
end
-- lo('?? kid_name:'..i..':'..tostring(k.name)..':'..tostring(k.attr.semantic))
dsem[k.attr['source']:sub(2)] = k.attr.semantic
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/ge/extensions/freeroam/facilities/fuelPrice.lua
for i=1, #v2.displayObjects do
local char = priceStr:sub(i, i)
-- force 9/10 in US signs
@/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/energyStorage.lua
local _, fileNameWithExt, _ = path.split(file)
local fileName = fileNameWithExt:sub(1, -5)
local storageFactoryPath = "energyStorage/" .. fileName
@/lua/common/libs/lua-luaepnf/epnf.lua
local string, io = assert( string ), assert( io )
local V = string.sub( assert( _VERSION ), -4 )
local _G = assert( _G )
for i = 1, p do
if string.sub( s, i, i ) == "\n" then
lno = lno + 1
for i = sol, #s do
if string.sub( s, i, i ) == "\n" then
eol = i - 1
end
return string.sub( s, sol, eol ), lno, sol
end
if #line > clen then
line = string.sub( line, 1, clen ) .. "..."
end
local _,lno = string.gsub( s, "\n", "\n" )
if string.sub( s, -1, -1 ) ~= "\n" then lno = lno + 1 end
local msg = ": parse error at "
function epnf.parsestring( g, str, ... )
local s = string.sub( str, 1, 20 )
if #s < #str then s = s .. "..." end
@/lua/ge/extensions/gameplay/statistic.lua
local _, file, _ = path.split(filePath)
local fileName = file:sub(1, -5)
local extensionPath = "gameplay/statisticModules/" .. fileName
activityType = "scenario"
activityDetail = "/fg"..missionId:sub(levelFolder:len()+1):gsub("/","@")
elseif scenario_scenarios and scenario_scenarios.getScenario() then
@/lua/ge/extensions/ui/liveryEditor/userData.lua
local _, fn, e = path.split(file)
return fn:sub(1, #fn - #dynDecalsExtension)
end
@/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
@/lua/vehicle/controller/vehicleController/shiftLogic/dctGearbox.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
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 isManualMode = string.sub(automaticHandling.mode, 1, 1) == "M"
--enforce things like L and M modes
for i = 1, modeCount do
local mode = modes:sub(i, i)
if automaticHandling.availableModeLookup[mode] then
@/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/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/ge/extensions/util/richPresence.lua
M.state.levelName = M.state.levelName:gsub("_", " ")
M.state.levelName = string.gsub(" "..M.state.levelName, "%W%l", string.upper):sub(2)
msgFormat()
@/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/common/jbeam/tableSchema.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)
@/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/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
@/lua/vehicle/controller/drivingDynamics/actuators/adaptiveDampers.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/vehicle/controller/drivingDynamics/actuators/activeDiffLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/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/tech/utils.lua
else
local _,level,_ = path.split(path.split(levelPath):sub(1, -2))
M.level = level
@/lua/ge/extensions/flowgraph/nodes/string/format.lua
if txt:len() > 16 then
im.Text(txt:sub(1,16).."...")
else
@/lua/ge/ge_utils.lua
function replace_char(pos, str, r)
return str:sub(1, pos-1) .. r .. str:sub(pos+1)
end
function replace_char(pos, str, r)
return str:sub(1, pos-1) .. r .. str:sub(pos+1)
end
function isPlayerVehConfig(vpath)
local osSep = package.config:sub(1,1)
if not shipping_build and FS:getGamePath() == FS:getUserPath() then return false end --make sure you don't delete official config
local k = math.random(1, sl)
res = res .. string.sub(ascii, k, k)
end
@/lua/ge/extensions/flowgraph/nodes/ui/contextTranslation.lua
for v in string.gmatch(translationString, "{{%a+}}") do
self:createPin('in', 'string', v:sub(3, -3), nil, '')
end
@/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/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/vehicle/controller/drivingDynamics/actuators/electronicDiffLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/lua/common/libs/luasocket/ltn12.lua
return function()
local chunk = string.sub(s, i, i+_M.BLOCKSIZE-1)
i = i + _M.BLOCKSIZE
@/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/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/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/ge/extensions/ui/uiNavi.lua
if minimapImage:startswith("/") then
minimapImage = minimapImage:sub(2)
end
@/lua/vehicle/controller/drivingDynamics/CMU.lua
if slashPos then
controllerName = controllerName:sub(slashPos + 1)
end
@/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
@/inspector/Views/Layers3DContentView.js
let delta = new THREE.Vector3;
this._boundingBox.clampPoint(this._controls.target, delta).setZ(0).sub(this._controls.target);
this._controls.target.add(delta);
@/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
@/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/common/libs/resty/template.lua
while s > 0 do
local c = sub(view, s, s)
if c == " " or c == "\t" or c == "\0" or c == "\x0B" then
local function escaped(view, s)
if s > 1 and sub(view, s - 1, s - 1) == "\\" then
if s > 2 and sub(view, s - 2, s - 2) == "\\" then
if s > 1 and sub(view, s - 1, s - 1) == "\\" then
if s > 2 and sub(view, s - 2, s - 2) == "\\" then
return false, 1
local file, location = path, vars and var.template_location
if sub(file, 1) == "/" then file = sub(file, 2) end
if location and location ~= "" then
local file, location = path, vars and var.template_location
if sub(file, 1) == "/" then file = sub(file, 2) end
if location and location ~= "" then
if location and location ~= "" then
if sub(location, -1) == "/" then location = sub(location, 1, -2) end
local res = capture(concat{ location, '/', file})
if location and location ~= "" then
if sub(location, -1) == "/" then location = sub(location, 1, -2) end
local res = capture(concat{ location, '/', file})
local root = vars and (var.template_root or var.document_root) or prefix
if sub(root, -1) == "/" then root = sub(root, 1, -2) end
return readfile(concat{ root, "/", file }) or path
local root = vars and (var.template_root or var.document_root) or prefix
if sub(root, -1) == "/" then root = sub(root, 1, -2) end
return readfile(concat{ root, "/", file }) or path
while s do
local t, p = sub(view, s + 1, s + 1), s + 2
if t == "{" then
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
c[j] = "___[#___+1]=template.escape("
c[j+1] = trim(sub(view, p, e - 1))
c[j+2] = ")\n"
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
c[j] = "___[#___+1]=template.output("
c[j+1] = trim(sub(view, p, e - 1))
c[j+2] = ")\n"
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
local n = e + 2
if sub(view, n, n) == "\n" then
n = n + 1
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, r)
c[j+2] = "]=]\n"
end
c[j] = trim(sub(view, p, e - 1))
c[j+1] = "\n"
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
else
local f = sub(view, p, e - 1)
local x = find(f, ",", 2, true)
c[j] = "___[#___+1]=include([=["
c[j+1] = trim(sub(f, 1, x - 1))
c[j+2] = "]=],"
c[j+2] = "]=],"
c[j+3] = trim(sub(f, x + 1))
c[j+4] = ")\n"
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
c[j] = "___[#___+1]=include("
c[j+1] = trim(sub(view, p, e - 1))
c[j+2] = ")\n"
if e then
local x, y = find(view, sub(view, s, e + 1), e + 2, true)
if x then
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
x = x - 1
if sub(view, y, y) == "\n" then
y = y + 1
end
local b = trim(sub(view, p, e - 1))
if b == "verbatim" or b == "raw" then
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
c[j] = "___[#___+1]=[=["
c[j+1] = sub(view, e + 2, x)
c[j+2] = "]=]\n"
else
if sub(view, x, x) == "\n" then
x = x - 1
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, r)
c[j+2] = "]=]\n"
c[j+2] = '"]=include[=['
c[j+3] = sub(view, e + 2, x)
c[j+4] = "]=]\n"
c[j] = "___[#___+1]=[=[\n"
c[j+1] = sub(view, i, s - 1 - w)
c[j+2] = "]=]\n"
e = e + 2
if sub(view, e, e) == "\n" then
e = e + 1
end
s = sub(view, i)
if s and s ~= "" then
@/lua/ge/extensions/gameplay/missions/proceduralMissionGenerators/timeTrialMissions.lua
local isRaceJson = string.sub(raceFile,#raceFile-9,#raceFile) == '.race.json'
@/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/perfProfiler.lua
local dir, fn, ext = path.split(file, true)
fn = fn:sub(0,fn:len()-ext:len()-1)
@/lua/ge/extensions/flowgraph/nodes/ui/multiDescription.lua
if txt:len() > 10 then
im.Text(txt:sub(1,10).."...")
else
@/lua/ge/extensions/editor/tech/roadArchitect/import.lua
if not ni then break end
local text = string.sub(s, i, ni - 1)
if not string.find(text, "^%s*$") then
end
local text = string.sub(s, i)
if not string.find(text, "^%s*$") then
@/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/editor/resourceChecker/resourceUtil.lua
local function strEnds(s, suffix)
return s and suffix and s:sub(-#suffix) == suffix
end
if title then
title = title:sub(2, -2)
t[title] = t[title] or {}
key = key:gsub(' ', "")
value = value:sub(2, -2)
t[titleS][key] = value
@/lua/ge/extensions/career/modules/delivery/progress.lua
if key:endswith("Reputation") then
local orgId = key:sub(1, -11)
local organization = freeroam_organizations.getOrganization(orgId)
@/lua/ge/extensions/career/saveSystem.lua
else
local newPath = string.sub(folders[i], oldNameLength + 2)
newPath = newName .. newPath
@/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/editor/gen/utils.lua
end
if (str:sub(i, i + (delimiter:len() - 1)) == delimiter) then
endPoint = i - 1;
endPoint = i - 1;
table.insert(result, str:sub(startPoint, endPoint));
startPoint = i + (delimiter:len());
endPoint = str:len();
table.insert(result, str:sub(startPoint, endPoint));
end
@/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/vizHelper.lua
for k, v in ipairs(vizHelper) do
vizHelper[k] = string.sub(v, string.len(artPath) + 1)
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/ge/extensions/editor/api/valueInspector.lua
elseif fieldTypeName == "TypeCommand" then
if imgui.Button(fieldValue:sub(1,20)) then
editor.newTextEditorInstance(self.selectedIds, fieldName)
@/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/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/career/career.lua
local currentSaveSlot, currentSavePath = career_saveSystem.getCurrentSaveSlot()
imgui.Text((string.sub(currentSavePath, string.len(career_saveSystem.getSaveRootDirectory())+2, -1)))
imgui.Separator()
@/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))
@/lua/ge/extensions/freeroam/bigMapMode.lua
if not mission then
mission = gameplay_missions_missions.getMissionById(string.sub(missionId, 1, -3))
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/ge/extensions/editor/tech/roadArchitect/utilities.lua
if lastSeparator then
return path:sub(1, lastSeparator)
end
@/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/vehicle/controller.lua
for _, v in pairs(loadedControllers) do
if v.typeName:sub(1, #path) == path then
table.insert(controllers, v)
@/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/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/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/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/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/ge/extensions/editor/assetBrowser.lua
if file.type == "image" then
local textureName = string.sub(file.fileName, 1, #file.fileName-2)
local textureType = string.sub(file.fileName, -2)
local textureName = string.sub(file.fileName, 1, #file.fileName-2)
local textureType = string.sub(file.fileName, -2)
if string.sub(textureType,1,1) == "_" then
local textureType = string.sub(file.fileName, -2)
if string.sub(textureType,1,1) == "_" then
textureType = string.sub(textureType,2,2)
if string.sub(textureType,1,1) == "_" then
textureType = string.sub(textureType,2,2)
if textureType == "n" or textureType == "d" or textureType == "s" then
-- TODO: check if filetype is present
fileName = string.sub(fileName, 1, #fileName - #fileType)
-- Remove the `.` from the filetype
-- Remove the `.` from the filetype
fileType = #fileType > 0 and string.lower(string.sub(fileType, 2)) or fileType
-- TODO: check if filetype is present
fileName = string.sub(fileName, 1, #fileName - #fileType)
-- Remove the `.` from the filetype
-- Remove the `.` from the filetype
fileType = #fileType > 0 and string.lower(string.sub(fileType, 2)) or fileType
local filename = string.match(filepath, "[^/]*$")
local fileDir = string.sub(filepath, 1, #filepath - #filename)
local dir = getDirByPath(fileDir, root, true)
local simpleFileType = string.lower(string.match(filename, "[^.]*$"))
local fileNameNoExt = string.sub(filename, 1, #filename - (#filetype+1))
local file = newFile(dir, dir.path..filename, fileNameNoExt, filetype, simpleFileType)
if levelName and string.lower(levelName) == string.lower(var.levelName) then
levelFilepath = string.sub(levelFilepath, 1, #levelFilepath - #filename)
dir = getDirByPath(levelFilepath, var.root)
elseif artFilepath then
artFilepath = string.sub(artFilepath, 1, #artFilepath - #filename)
dir = getDirByPath(artFilepath, var.commonArt)
@/lua/ge/extensions/flowgraph/graph.lua
for color, orderList in pairs(rootWork) do
if string.sub(color.name, 1, 2) == 'on' then
if self.hookList[color.name] == nil then
@/lua/ge/extensions/editor/api/gui.lua
if withoutExtension then
filename = string.sub(filename, 1, #filename - 4)
end
if not pos2 then
imgui.TextColored(textColor, text:sub(pos1))
break
elseif pos1 < pos2 then
imgui.TextColored(textColor, text:sub(pos1, pos2 - 1))
imgui.SameLine()
local pos3 = pos2 + highlightLowerLen
imgui.TextColored(textHighlightColor, text:sub(pos2, pos3))
imgui.SameLine()
@/lua/ge/server/server.lua
local levelDir = path.dirname(levelPath)
if string.sub(levelDir, -1) ~= '/' then
levelDir = levelDir.."/"
@/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/ge/extensions/util/inputSystemUtils.lua
-- collapse anything below bindings that has less than 4 items
return path:sub(1,10) == '/bindings/' and tableSize(item) < 4
end
info.vidpid = filename:upper()
vendorId = filename:upper():sub(5, 8)
else
else
vendorId = info.vidpid:upper():sub(5, 8)
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/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/libs/slaxml/slaxml.lua
if first>textStart and self._call.text then
local text = sub(xml,textStart,first-1)
if options.stripWhitespace then
@/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/ge/extensions/trackbuilder/trackBuilder.lua
for _, file in pairs(FS:findFiles(materialSettings.directory, "*.dds", -1, true, false)) do
local fileWithoutExtension = string.sub(file, 1, string.len(file) - 4)
local textureType = string.sub(fileWithoutExtension, string.len(fileWithoutExtension) - 1, string.len(fileWithoutExtension))
local fileWithoutExtension = string.sub(file, 1, string.len(file) - 4)
local textureType = string.sub(fileWithoutExtension, string.len(fileWithoutExtension) - 1, string.len(fileWithoutExtension))
local path = {}
local path = {}
for str in string.gmatch(string.sub(fileWithoutExtension, 1, string.len(fileWithoutExtension) - 2), "([^'/']+)") do
table.insert( path, str )
else -- glow map
local texType = string.sub(fileWithoutExtension, string.len(fileWithoutExtension) - 4, string.len(fileWithoutExtension))
if texType == "decal" then
local path = {}
for str in string.gmatch(string.sub(fileWithoutExtension, 1, string.len(fileWithoutExtension) - 6), "([^'/']+)") do
table.insert( path, str )
if editor.uiIconImageButton(editor.icons.undo, im.ImVec2(16,16), style.buttonColorBase, nil, nil, "resetMaterialButton") then
local materialLetter = string.sub(materials.matNames[materialSettings.selectedMaterial[0]+1],14,14)
tb.materialUtil.resetMaterialsToDefault(materialLetter)
local mat = tb.getPieceInfo(index, sub).materialInfo.centerMesh or 'track_editor_A_center'
mat = string.sub(mat, 0, 15)
materialSettings.selectedMaterial[0] = indexOf(materials.matNames,mat)-1
local mat = tb.getIntersection(name).centerMat or 'track_editor_A_center'
mat = string.sub(mat, 0, 15)
materialSettings.selectedMaterial[0] = indexOf(materials.matNames,mat)-1
@/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/flowgraph/manager.lua
-- TODO: clear up hack with filepaths (issue when loading a FG as a mission)
local path = dirname:sub(string.len(customNodePath) + string.find(dirname, customNodePath, 1, true))
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 status, node = pcall(rerequire, requireFilename)
@/lua/vehicle/controller/drivingDynamics/actuators/electronicSplitShaftLock.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/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/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/vehicle/controller/drivingDynamics/actuators/activeDiffBias.lua
if slashPos then
nameString = nameString:sub(slashPos + 1)
end
@/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/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/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/editor/veMain.lua
local _, fn, _ = path.split(file)
local name = string.sub(fn, 1, -5)
if name ~= "veMain" then
local _, fn, _ = path.split(file)
local name = string.sub(fn, 1, -5)
if name ~= "veMain" then
local _, fn, _ = path.split(file)
local name = string.sub(fn, 1, -5)
if name ~= "veMain" then
@/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/ge/extensions/editor/engineAudioDebug.lua
local dataString = jsonEncodePretty(data)
dataString = dataString:sub(3, dataString:len() - 2)
setClipboard(dataString)
@/lua/common/jbeam/slotSystem.lua
if type(v3) == "number" and str_byte(k3, 1) == 36 then
local actualK3 = k3:sub(3) --remove the magic chars at the beginning to get the actual KEY, this can potentially lead to issues if k3 omits the second magic char
local existingValue = target[sectionKey][actualK3]
@/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/libs/lua-websockets/websocket/client_ev.lua
end
until response:sub(#response-3) == '\r\n\r\n'
read_io:stop(loop)
@/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/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
@/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/scenario/busdriver.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
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
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
else
else
return tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255
end
else
return tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255
end
else
return tonumber("0x"..hex:sub(1,2))/255, tonumber("0x"..hex:sub(3,4))/255, tonumber("0x"..hex:sub(5,6))/255
end
@/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