type
Definition
-- @/=[C]:-1
function type(...)
Callers
@/lua/common/libs/lua-MessagePack/MessagePack.lua
local function typeerror(caller, narg, arg, tname)
argerror(caller, narg, tname .. " expected, got " .. type(arg))
end
local function checktype(caller, narg, arg, tname)
if type(arg) ~= tname then
typeerror(caller, narg, arg, tname)
for k, v in pairs(tbl) do
local typek = type(k)
packers[typek == 'string' and 'tstring' or typek](k)
packers[typek == 'string' and 'tstring' or typek](k)
packers[type(v)](v)
end
local v = tbl[i]
packers[type(v)](v)
end
for k in pairs(tbl) do
if type(k) == 'number' and k > 0 then
if k > max then
for k in pairs(tbl) do
if type(k) == 'number' and k > 0 then
if k > max then
bufTmp:reset()
packers[type(data)](data)
return bufTmp
bufTmp:reset():put(prefix)
packers[type(data)](data)
return bufTmp
function m.unpacker(src)
if type(src) == 'string' then
local cursor = cursor_string(src)
end
elseif type(src) == 'function' then
local cursor = cursor_loader(src)
else
argerror('unpacker', 1, "string or function expected, got " .. type(src))
end
@/lua/ge/extensions/flowgraph/nodes/debug/drawGraph.lua
for l, pin in pairs(self.pinIn) do
if pin.value and type(pin.value) == "number" then
if not self.graphData[i] then self.graphData[i] = {} end
@/lua/ge/extensions/ui/vehicleSelector/vehicleSpecifications.lua
value = function(value)
if type(value) == 'table' and value.min and value.max and type(value.min) == 'number' and type(value.max) == 'number' then
return string.format("%0.2f - %0.2f", value.min, value.max)
value = function(value)
if type(value) == 'table' and value.min and value.max and type(value.min) == 'number' and type(value.max) == 'number' then
return string.format("%0.2f - %0.2f", value.min, value.max)
value = function(value)
if type(value) == 'table' and value.min and value.max and type(value.min) == 'number' and type(value.max) == 'number' then
return string.format("%0.2f - %0.2f", value.min, value.max)
years = function(value)
if type(value) == 'table' and value.min and value.max and type(value.min) == 'number' and type(value.max) == 'number' then
return string.format("%d - %d", value.min, value.max)
years = function(value)
if type(value) == 'table' and value.min and value.max and type(value.min) == 'number' and type(value.max) == 'number' then
return string.format("%d - %d", value.min, value.max)
years = function(value)
if type(value) == 'table' and value.min and value.max and type(value.min) == 'number' and type(value.max) == 'number' then
return string.format("%d - %d", value.min, value.max)
-- Format with comma separators for thousands and dot for decimals
if not type(value) == 'number' then
return tostring(value)
seconds = function(value)
if not type(value) == 'number' then
return tostring(value)
g = function(value)
if not type(value) == 'number' then
return tostring(value)
kmh = function(value)
if not type(value) == 'number' then
return tostring(value)
mph = function(value)
if not type(value) == 'number' then
return tostring(value)
torque = function(value, modelDetails, configDetails)
if not type(value) == 'number' then
return tostring(value)
power = function(value, modelDetails, configDetails)
if not type(value) == 'number' then
return tostring(value)
speed = function(value)
if not type(value) == 'number' then
return tostring(value)
weightPower = function(value)
if not type(value) == 'number' then
return tostring(value)
weight = function(value)
if not type(value) == 'number' then
return tostring(value)
distanceMinor = function(value)
if not type(value) == 'number' then
return tostring(value)
table.insert(iconTags, {icon = "4WD", label = "Drivetrain: 4 Wheel Drive"})
elseif configDetails.Drivetrain and type(configDetails.Drivetrain) == 'string' and string.find(configDetails.Drivetrain, "x") then
table.insert(iconTags, {iconText = string.gsub(configDetails.Drivetrain, "x", "×"), label = "Drivetrain: "..string.gsub(configDetails.Drivetrain, "x", "×")})
@/lua/common/utils.lua
function parseColor(v)
if type(v) == 'table' then
return color(v.r, v.g, v.b, v.a)
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("#","")
if narg == 0 then return '' end
if type(...) == "userdata" then
local metatable = getmetatable(...)
local function jsonEncode_rec(v)
local vtype = type(v)
if vtype == 'string' then
for kk, vv in pairs(v) do
bufTmp:put(prefix, type(kk) == 'string' and escapeString(kk) or kk, '":')
jsonEncode_rec(vv)
if v == nil then return "null" end
local vtype = type(v)
if vtype == 'string' then return stringformat('"%s"', escapeString(v)) end
local function jsonWriteFileActual(filename, obj, pretty, numberPrecision)
local objType = type(obj)
if objType ~= "table" then
else
local tempFileName = (type(atomicWrite) == "string") and atomicWrite or (filename .. ".tmp")
if jsonWriteFileActual(tempFileName, obj, pretty, numberPrecision) then
local v = select(i, ...)
local vtype = type(v)
if vtype == 'number' then
for k, v1 in ipairs(v) do
local vtype1 = type(v1)
if vtype1 == 'number' then
function tableIsDict(tbl)
if type(tbl) ~= "table" then
return false
for k, _ in pairs(tbl) do
if type(k) ~= 'number' or k < 1 or k > tblSize then return false end
end
function tableIsEmpty(tbl)
return type(tbl) ~= 'table' or next(tbl) == nil
end
local function tableSortCompareMultiType(a, b)
local typeA, typeB = type(a), type(b)
if typeA ~= typeB then
local function tableSortCompareMultiType(a, b)
local typeA, typeB = type(a), type(b)
if typeA ~= typeB then
for k, v in pairs(t2) do
if type(v) == "table" and type(t1[k]) == "table" then
tableMergeRecursive(t1[k], t2[k])
for k, v in pairs(t2) do
if type(v) == "table" and type(t1[k]) == "table" then
tableMergeRecursive(t1[k], t2[k])
for k, v in pairs(t2) do
if type(v) == "table" and type(t1[k]) == "table" then
if tableIsArraySlow(t1[k]) and tableIsArraySlow(v) then
for k, v in pairs(t2) do
if type(v) == "table" and type(t1[k]) == "table" then
if tableIsArraySlow(t1[k]) and tableIsArraySlow(v) then
end
elseif type(v) == "table" then
-- Copy the table (array or associative)
function tableSize(tbl)
if type(tbl) ~= "table" then
return 0
function tableDepth(tbl, lookup)
if type(tbl) ~= 'table' then return 0 end
lookup = lookup or {}
for k, v in pairs(tbl) do
if type(k) == "table" then
lookup[k] = lookup[k] or tableDepth(k, lookup)
end
if type(v) == "table" then
lookup[v] = lookup[v] or tableDepth(v, lookup)
function shallowcopy(orig)
if type(orig) == 'table' then
local copy = table.new(#orig, 0)
for index, value in pairs(object) do
if type(index) == 'table' then
index = lookup_table[index] or _deepcopyTable(lookup_table, index)
end
if type(value) == 'table' then
value = lookup_table[value] or _deepcopyTable(lookup_table, value)
function deepcopy(object)
local otype = type(object)
if otype == 'table' then
local sanitizedExpectedType = isOptional and expectedType:sub(10, #expectedType) or expectedType
local actualType = type(data[k])
local isDirectMatch = actualType == sanitizedExpectedType
if not (isDirectMatch or (isOptional and actualType == "nil")) then
return false, string.format("Wrong data type on param %d, expected: %q, actual: %q", k, expectedType, type(data[k]))
end
if type(entry) == 'function' then
return false
return false
elseif type(entry) == 'table' and entry.__extensionName__ then
return false
for k, v in pairs(src) do
dst[k] = type(v) ~= "function" and v or nil
end
local function _unsafeSerializePackage(k, v, reason)
if type(v['onSerialize']) == 'function' then
return v['onSerialize'](reason) -- this is calling M.onSerialize()
for k, v in pairs(package.loaded) do
if isPackage(k, v) and type(v) == 'table' and (v['onDeserialized'] ~= nil or v['onSerialize'] ~= nil) then
local success, result = xpcall(_unsafeSerializePackage, debug.traceback, k, v, reason)
local function _unsafeDeserializePackage(k, v, data)
if type(v['onDeserialize']) == 'function' then
v['onDeserialize'](data[k])
v['onDeserialize'](data[k])
elseif type(v['state']) == 'table' then
tableMergeExceptFunc(v['state'], data[k])
end
if type(v['onDeserialized']) == 'function' then
v['onDeserialized'](data[k])
for k,v in pairs(package.loaded) do
if isPackage(k, v) and (filter == nil or k == filter) and type(v) == 'table' and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil) and data[k] ~= nil then
local success, err = xpcall(_unsafeDeserializePackage, debug.traceback, k, v, data)
local function serialize_rec(v)
local vtype = type(v)
local incl = v._serialize
if type(incl) == "table" then
for kk, vv in pairs(v) do
if incl[kk] then
bufTmp:putf(type(kk) == 'string' and "%q;" or "%s;", kk)
serialize_rec(vv)
for kk, vv in pairs(v) do
bufTmp:putf(type(kk) == 'string' and "%q;" or "%s;", kk)
serialize_rec(vv)
else
bufTmp:putf(type(kk) == 'string' and "%s[%q]=" or "%s[%s]=", prefix, kk)
end
else
log("E", "serialize", "Unrecognized data type: "..type(v))
end
local v = tbl[k]
if type(v) == 'table' then
local tblPtr = tostring(v)
function flattenTable(tbl)
if type(tbl) ~= 'table' then return nil end
_flattenTable_rec(tbl, {}, '')
for k, v in pairs(tbl) do
if type(v) == 'table' then
local newPath = path .. '/' .. tostring(k)
_unflattenTable_rec(v, tableRegister, newPath)
elseif type(v) == 'string' and v:match("%>%#%>(.*)") then
if not tableRegister[v] then
function unflattenTable(tbl)
if type(tbl) ~= 'table' then return nil end
_unflattenTable_rec(tbl, {}, '')
@/lua/common/mathlib.lua
function LuaVec3.__mul(a, b)
if type(b) == 'number' then
return newLuaVec3xyz(b * a.x, b * a.y, b * a.z)
function StackVec3.__mul(a, b)
b = type(a) == 'number' and a or b
local s = stackv3[stacki-1]
if rawequal(y, nil) then
if type(x) == 'table' and x[4] ~= nil then
return newLuaQuatxyzw(x[1], x[2], x[3], x[4])
function LuaQuat.__mul(a, b)
if type(a) == 'number' then
return newLuaQuatxyzw(b.x*a, b.y*a, b.z*a, b.w*a)
return newLuaQuatxyzw(b.x*a, b.y*a, b.z*a, b.w*a)
elseif type(b) == 'number' then
return newLuaQuatxyzw(a.x*b, a.y*b, a.z*b, a.w*b)
function LuaQuat.__div(a, b)
if type(b) == 'number' then
return newLuaQuatxyzw(a.x / b, a.y / b, a.z / b, a.w / b)
function LuaQuat:setMul2(a, b)
if type(a) == 'number' then
self.x, self.y, self.z, self.w = b.x * a, b.y * a, b.z * a, b.w * a
self.x, self.y, self.z, self.w = b.x * a, b.y * a, b.z * a, b.w * a
elseif type(b) == 'number' then
self.x, self.y, self.z, self.w = a.x * b, a.y * b, a.z * b, a.w * b
@/lua/vehicle/input.lua
if h.inputSource == "steering_input" then
if type(h.steeringAutocenterEnabled) == "boolean" then
steeringAutocenterEnabled = h.steeringAutocenterEnabled
if h.inputSource == "steering_input" then
if type(h.lowspeedCoefFFB) == "boolean" then
M.lowspeedCoefFFB = h.lowspeedCoefFFB
-- slower autocenter at low speed
if type(steeringAutocenterEnabled) == "boolean" then
autocenterEnabled = steeringAutocenterEnabled
@/lua/ge/extensions/gameplay/missions/startTrigger.lua
local function levelTriggerList(trigger,locations)
if type(trigger.level) == 'string' then
table.insert(locations, {level=trigger.level, pos=nil, radius=nil, check=defaultLocationCheck, displayMarker=defaultLocationDisplayMarker})
table.insert(locations, {level=trigger.level, pos=nil, radius=nil, check=defaultLocationCheck, displayMarker=defaultLocationDisplayMarker})
elseif type(trigger.level) == 'table' then
for _, lvl in ipairs(trigger.level) do
@/lua/ge/extensions/flowgraph/nodes/vehicle/ai/goToEndLine.lua
local endLinePosition = self.pinIn.endLinePosition.value
if type(endLinePosition) == "table" then
endLinePosition = vec3(endLinePosition)
@/lua/ge/extensions/flowgraph/nodes/gameplay/groundmarkers.lua
-- different types?
if type(self.lastTarget) ~= type(self.pinIn.target.value) then
--print("groundmarkers: different types: " .. type(self.lastTarget) .. " " .. type(self.pinIn.target.value))
-- different types?
if type(self.lastTarget) ~= type(self.pinIn.target.value) then
--print("groundmarkers: different types: " .. type(self.lastTarget) .. " " .. type(self.pinIn.target.value))
if type(self.lastTarget) ~= type(self.pinIn.target.value) then
--print("groundmarkers: different types: " .. type(self.lastTarget) .. " " .. type(self.pinIn.target.value))
return true
if type(self.lastTarget) ~= type(self.pinIn.target.value) then
--print("groundmarkers: different types: " .. type(self.lastTarget) .. " " .. type(self.pinIn.target.value))
return true
-- same type, table?
if type(self.lastTarget) == 'table' and type(self.lastTarget) == 'table' then
-- different size?
-- same type, table?
if type(self.lastTarget) == 'table' and type(self.lastTarget) == 'table' then
-- different size?
local threshold = self.pinIn.threshold.value or 0.1
if type(self.lastTarget[i]) == 'number' and type(self.pinIn.target.value[i]) == 'number' then
if math.abs(self.lastTarget[i] - self.pinIn.target.value[i]) > threshold then
local threshold = self.pinIn.threshold.value or 0.1
if type(self.lastTarget[i]) == 'number' and type(self.pinIn.target.value[i]) == 'number' then
if math.abs(self.lastTarget[i] - self.pinIn.target.value[i]) > threshold then
end
if type(self.lastTarget) == 'string' and type(self.pinIn.target.value) == 'string' then
if self.lastTarget ~= self.pinIn.target.value then
end
if type(self.lastTarget) == 'string' and type(self.pinIn.target.value) == 'string' then
if self.lastTarget ~= self.pinIn.target.value then
self.lastTarget = target
if type(target) == 'table' and type(target[1]) == 'number' then
target = vec3(target)
self.lastTarget = target
if type(target) == 'table' and type(target[1]) == 'number' then
target = vec3(target)
@/lua/vehicle/material.lua
lastValues[f] = v
if type(v) == "boolean" then
v = v and 1 or 0
@/lua/common/introspection.lua
for key, value in pairs(tbl) do
if type(key) == "string" and type(value) == "function" then
-- Ignore keys starting with "__"
for key, value in pairs(tbl) do
if type(key) == "string" and type(value) == "function" then
-- Ignore keys starting with "__"
if global_key ~= "extensions" then
if type(global_key) == "string" then
if type(global_value) == "table" then
if type(global_key) == "string" then
if type(global_value) == "table" then
-- Check if the table has a ___type field indicating a class
local module = _G[module_name]
if type(module) == "table" then
gather_from_table(module, module_name, true)
@/lua/vehicle/extensions/tech/vehicleSearcher.lua
for k, v in pairs(electrics.values) do
if type(k) == 'string' and type(v) ~= 'table' and type(v) ~= 'string' then
if not string.find(k, "parent") then
for k, v in pairs(electrics.values) do
if type(k) == 'string' and type(v) ~= 'table' and type(v) ~= 'string' then
if not string.find(k, "parent") then
for k, v in pairs(electrics.values) do
if type(k) == 'string' and type(v) ~= 'table' and type(v) ~= 'string' then
if not string.find(k, "parent") then
if not string.find(k, "parent") then
elData[eCtr] = { name = k, type = type(v) }
eCtr = eCtr + 1
local fullName = prefix .. kI
if not string.find(fullName, "parent") and type(vI) ~= 'string' then
pProc[pCtr] = { name = tostring(fullName), type = type(vI) }
if not string.find(fullName, "parent") and type(vI) ~= 'string' then
pProc[pCtr] = { name = tostring(fullName), type = type(vI) }
pCtr = pCtr + 1
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamVariablesChecker.lua
local function checkValInRange(vv, val, varDefFilename, valDefFilename, partName)
if type(val) ~= 'number' or type(vv.min) ~= 'number' or type(vv.max) ~= 'number' then
return
local function checkValInRange(vv, val, varDefFilename, valDefFilename, partName)
if type(val) ~= 'number' or type(vv.min) ~= 'number' or type(vv.max) ~= 'number' then
return
local function checkValInRange(vv, val, varDefFilename, valDefFilename, partName)
if type(val) ~= 'number' or type(vv.min) ~= 'number' or type(vv.max) ~= 'number' then
return
@/lua/ge/spawn.lua
local pc = ''
if type(options.config) == 'string' then
pc = options.config
pc = options.config
elseif type(options.config) == 'table' then
pc = serialize(options.config)
@/lua/common/utils/simpleHttpServer.lua
local res = v[2](req, res)
if type(res) == 'table' then
return serve_json(res)
@/lua/common/jbeam/materials.lua
local cmd = nil
if type(gm.simpleFunction) == "string" then
cmd = gm.simpleFunction
triggerSet[gm.simpleFunction] = true
elseif type(gm.simpleFunction) == "table" then
for fk, fc in pairs(gm.simpleFunction) do
if b.deformGroup then
local deformGroups = type(b.deformGroup) == "table" and b.deformGroup or {b.deformGroup}
for _, g in pairs(deformGroups) do
@/lua/vehicle/powertrain/compressor.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartPropertyView.lua
for k, v in pairs(vEditor.propertyTableEditTarget or {}) do
if k ~= '__astNodeIdx' and type(v) ~= 'table' and k ~= '__schemaProcessed' then
local t = {}
t.value = tostring(v)
if type(v) == 'number' then
t.type = 'float'
t.type = 'float'
elseif type(v) == 'boolean' then
t.type = 'bool'
@/lua/ge/extensions/editor/multiSpawnManager.lua
local colorTbl
if type(val) == "table" and val.baseColor then
if val.baseColor[4] then
local function createSortedArray(t) -- returns a sorted list of values from a dict
if type(t) ~= "table" then return {} end
@/lua/common/libs/luamqtt/mqtt/bitwrap.lua
if _VERSION == "Lua 5.1" or type(jit) == "table" then -- Lua 5.1 or LuaJIT (based on Lua 5.1)
return require("bit") -- custom module https://luarocks.org/modules/luarocks/luabitop
@/lua/ge/extensions/core/cameraModes/driver.lua
local vehConfigs = settings.getValue('cameraDriverVehicleConfigs')
if type(vehConfigs) ~= "string" then vehConfigs = "{}" end
vehConfigs = vehConfigs:gsub("'",'"') -- fix INI values that passed through javascript (e.g. when opening Options menu)
local vehConfigs = settings.getValue('cameraDriverVehicleConfigs')
if type(vehConfigs) ~= "string" then vehConfigs = "{}" end
vehConfigs = vehConfigs:gsub("'",'"') -- fix INI values that passed through javascript (e.g. when opening Options menu)
@/lua/ge/extensions/core/multiSpawn.lua
if params.maxYear then
if type(config.Years) == 'table' then
config.yearMax = config.Years.max
local configValue = config[k] or 'default' -- unsure about this actually
if type(configValue) == 'string' then configValue = string.lower(configValue) end
if type(configValue) == 'table' then
local filterKeyFound = false
for k, v in pairs(configValue) do
if type(filter[k]) == 'number' then -- filter value
factor = factor * filter[k]
if not filterKeyFound then
factor = type(filter.other) == 'number' and factor * filter.other or 0 -- if 'other' exists, use it; otherwise, factor becomes 0
end
else
if type(filter[configValue]) == 'number' then -- filter value
factor = factor * filter[configValue]
else
factor = type(filter.other) == 'number' and factor * filter.other or 0 -- if 'other' exists, use it; otherwise, factor becomes 0
end
if type(configCopy.Population) ~= 'number' then
if not officialModel or not officialConfig then
local transformData
if spawnOptions and type(spawnOptions.customTransforms) == 'table' and #spawnOptions.customTransforms >= #spawnData then
transformData = spawnOptions.customTransforms
local instant = options and options.instant
if options and type(options.customTransforms) == 'table' and #options.customTransforms >= #vehIds then
transformData = options.customTransforms
@/lua/ge/extensions/editor/trafficSignalsEditor.lua
im.PopItemWidth()
im.tooltip("Number of states for this controller type (e.g. 3 states for a green, yellow, & red traffic light).")
@/lua/ge/extensions/flowgraph/nodes/vehicle/beamstate/breakgroup.lua
local groups
if type(self.pinIn.group.value == 'string') then
if self.pinIn.group.value == '*' then
@/lua/ge/extensions/editor/driftDataEditor.lua
for _, elem in ipairs(json.stuntZones or {}) do
if elem.pos and type(elem.pos) == "table" and elem.pos.x and elem.pos.y and elem.pos.z then elem.pos = vec3(elem.pos) end
if elem.rot and type(elem.rot) == "table" and elem.rot.x and elem.rot.y and elem.rot.z and elem.rot.w then elem.rot = quat(elem.rot) end
if elem.pos and type(elem.pos) == "table" and elem.pos.x and elem.pos.y and elem.pos.z then elem.pos = vec3(elem.pos) end
if elem.rot and type(elem.rot) == "table" and elem.rot.x and elem.rot.y and elem.rot.z and elem.rot.w then elem.rot = quat(elem.rot) end
if elem.scl and type(elem.scl) == "table" and elem.scl.x and elem.scl.y and elem.scl.z then elem.scl = vec3(elem.scl) end
if elem.rot and type(elem.rot) == "table" and elem.rot.x and elem.rot.y and elem.rot.z and elem.rot.w then elem.rot = quat(elem.rot) end
if elem.scl and type(elem.scl) == "table" and elem.scl.x and elem.scl.y and elem.scl.z then elem.scl = vec3(elem.scl) end
if elem.scl and type(elem.scl) == "number" then end
if elem.scl and type(elem.scl) == "table" and elem.scl.x and elem.scl.y and elem.scl.z then elem.scl = vec3(elem.scl) end
if elem.scl and type(elem.scl) == "number" then end
end
@/inspector/Views/TimelineTabContentView.js
get type()
{
@/lua/ge/ge_utils.lua
else
print(' * ' .. tostring(k) .. ' = ' .. tostring(player[k]) .. ' [Types| Lua: ' .. type(val) .. ', C: ' .. (f.type or 'unknown') .. ']')
end
if type(v) == 'string' then
argsStr = argsStr .. '"' .. v .. '"'
if type(v) == 'string' then
argsStr = argsStr .. '"' .. v .. '"'
if type(inp) == 'string' then
-- parse the string then
if type(objPos) == 'string' then
local x, y, z = string.match(objPos, "([0-9]*)%s*([0-9]*)%s*([0-9]*)%s*")
if type(objRotation) == 'string' then
local x, y, z, w = string.match(objRotation, "([0-9]*)%s*([0-9]*)%s*([0-9]*)%s*([0-9]*)")
if type(objScale) == 'string' then
local x, y, z = string.match(objScale, "([0-9]*)%s*([0-9]*)%s*([0-9]*)%s*")
function convertVehicleColorsToPaints(colorTable)
if type(colorTable) ~= 'table' then
log('W','vehiclePaint','colorTable parameter should be a table of colors. type = '..type(colors)..' colors = '..dumps(colors))
if type(colorTable) ~= 'table' then
log('W','vehiclePaint','colorTable parameter should be a table of colors. type = '..type(colors)..' colors = '..dumps(colors))
colorTable = {}
end
metallicData = type(metallicData) == 'table' and metallicData or {}
local metallic = metallicData.metallic or tonumber(metallicData[1]) or 0.2
function validateVehiclePaint(paint)
if type(paint) ~= 'table' then
log('W','validateVehiclePaint','paint parameter should be a table.')
function vehicleMetallicPaintDataFromColor(colorTable)
if type(colorTable) ~= 'table' then
log('W','vehicleMetallicPaintDataFromColor','colorTable parameter should be a table.')
local validatedColor = color or "1 1 1 1"
if type(color) == 'string' then
local components = string.split(validatedColor)
validatedColor = string.format("%0.2f %0.2f %0.2f %0.2f", tonumber(components[1]), tonumber(components[2]), tonumber(components[3]), tonumber(components[4]))
elseif type(color) == 'table' then
validatedColor = string.format("%0.2f %0.2f %0.2f %0.2f", color[1] or 1, color[2] or 1, color[3] or 1, color[4] or 1)
local config
if type(opt.config) == 'string' then
if string.endswith(opt.config, '.pc') then
for _,v in ipairs(components) do
if type(tonumber(v)) == 'number' then
countNumericEntries = countNumericEntries + 1
end
if opt.color and type(opt.color) == 'string' then
if not opt.paintName and not isColor4(opt.color) then
if opt.color2 and type(opt.color2) == 'string' then
if not opt.paintName2 and not isColor4(opt.color2) then
if opt.color3 and type(opt.color3) == 'string' then
if not opt.paintName3 and not isColor4(opt.color3) then
if opt.paintName and type(opt.paintName) == 'string' then
opt.paint = modelPaints[opt.paintName] or modelPaints[config.defaultPaintName1]
if opt.paintName2 and type(opt.paintName2) == 'string' then
opt.paint2 = modelPaints[opt.paintName2] or modelPaints[config.defaultPaintName2]
if opt.paintName3 and type(opt.paintName3) == 'string' then
opt.paint3 = modelPaints[opt.paintName3] or modelPaints[config.defaultPaintName3]
opt.config = 'vehicles/' .. modelName .. '/' .. model.model.default_pc .. '.pc'
elseif type(opt.config) == 'string' and not string.find(opt.config, '.pc') and FS:fileExists('/vehicles/' .. modelName .. '/' .. opt.config .. '.pc') then
opt.config = 'vehicles/' .. modelName .. '/' .. opt.config .. '.pc'
local result
if data and type(data) == 'table' then
result = {}
local result = {}
if data and type(data) == 'table' then
result = {}
function fileExistsOrNil(path)
if type(path) == 'string' and FS:fileExists(path) then
return path
function escape_magic(str)
assert(type(str) == "string", "utils.escape: Argument 'str' is not a string.")
local escaped = str:gsub('[%-%.%+%[%]%(%)%^%%%?%*%^%$]','%%%1')
@/lua/common/graphpath.lua
que1:clear()
if not state or type(state) == 'cdata' then -- state is an initial direction vector
initDir = state or curSegDir -- state is not mandatory
@/lua/vehicle/energyStorage/n2oTank.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/ge/extensions/editor/mainToolbar.lua
local success, data = pcall(jsonReadFile, settingsPath)
if success and data and type(data) == "table" and data.sets and type(data.sets) == "table" then
editModeSets = data.sets
local success, data = pcall(jsonReadFile, settingsPath)
if success and data and type(data) == "table" and data.sets and type(data.sets) == "table" then
editModeSets = data.sets
@/lua/ge/extensions/scenario/busdriver.lua
--log("E", logTag, "onPreRender nextStop("..dumps(type(nextStop))..")="..dumps(nextStop))
local vec3Destination = vec3(nextStop[3])
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamTableVis.lua
if type(header[1]) == "string" then
table.remove(t, 1)
for k, v in pairs(data) do
if type(v) == "table" then
local allEquallySizedTables = false
for k1, v1 in ipairs(v) do
if type(v1) == "table" then
if firstCount == -1 then
allEquallySizedTables = firstCount == tableSize(v1)
allExceptFirstHaveNums = type(v1[1]) == "number" and type(v1[2]) == "number"
allEquallySizedTables = firstCount == tableSize(v1)
allExceptFirstHaveNums = type(v1[1]) == "number" and type(v1[2]) == "number"
@/lua/ge/extensions/flowgraph/nodes/ui/raceRecoveriesUsed.lua
if self.pinIn.cur.value and self.pinIn.flow.value then
if type(self.pinIn.cur.value) == 'string' then
guihooks.trigger('RaceRecoveryCounterSet', self.pinIn.cur.value)
@/lua/common/libs/luasocket/socket/tp.lua
if not code then return nil, reply end
if base.type(ok) ~= "function" then
if base.type(ok) == "table" then
if base.type(ok) ~= "function" then
if base.type(ok) == "table" then
for i, v in base.ipairs(ok) do
@/lua/common/jbeam/links.lua
for keyEntry, entry in pairs(vehicle) do
if type(entry) == "table" then
local keysLen = 0
-- Check for links of the form: "link:section":[1,2,3,4]
if type(rowValue) == "table" then
if str_find(rowKey, ':', 1, true) then
if vehicle[sectionName] ~= nil then
if type(cellValue) == "table" then
-- this is for special cases like this:
for sectionName, section in pairs(vehicle) do
if type(section) == "table" then
-- walk all rows
-- walk all vehicle sections
if type(entry) == "table" then
for _, rowValue in pairs(entry) do
for _, rowValue in pairs(entry) do
if type(rowValue) == "table" then
-- walk all cells
if groupname then
if type(groupvals) == 'string' then
groupvals = {groupvals}
if vgn ~= nil then
local typevgn = type(vgn)
if typevgn == 'string' then
@/lua/vehicle/protocols.lua
for _,protocol in ipairs(protocols) do
if type(protocol.module.reset) == "function" then
protocol.module.reset()
end
if type(protocol.module.init) == "function" then
protocol.module.init()
@/lua/ge/extensions/editor/aiTests.lua
local p = params[key]
if type(p[1][0]) == "number" then
if editor.uiSliderFloat(key, p[1], p[2] or 0, p[3] or 4, "%0.2f", nil, editEnded) then
end
elseif type(p[0]) == "boolean" then
if im.Checkbox(key, p[1]) then
@/lua/ge/extensions/editor/scriptAIEditor.lua
-- Check if data is already in pointer format (has .x[0] structure) or value format (has .x structure).
if d[1] and d[1].x and type(d[1].x) == "table" and d[1].x[0] ~= nil then -- Data is already in pointer format.
nodes = d
@/lua/ge/extensions/flowgraph/nodes/ui/flashMessage.lua
local msg = self.pinIn.message.value
if type(msg) ~= 'table' then
msg = tostring(msg)
@/inspector/Views/AuditTabContentView.js
get type()
{
@/lua/ge/extensions/editor/sceneTree.lua
node.cameraDistance = math.huge
if object and type(object.getPosition) == 'function' then
local nodePos = object:getPosition()
@/lua/vehicle/powertrain/shaft.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/ge/extensions/tech/sumoExporter.lua
for k, v in pairs(node) do
if type(v) == 'table' then
children[k] = v
@/lua/ge/extensions/editor/missionEditor.lua
local translatedStarLabel = instance.starLabels[key]
if type(translatedStarLabel) == "function" then
translatedStarLabel = instance.starLabels[key](instance, {})
if type(translatedStarLabel) == "string" then
translatedStarLabel = translateLanguage(translatedStarLabel, translatedStarLabel, true)
translatedStarLabel = translateLanguage(translatedStarLabel, translatedStarLabel, true)
elseif type(translatedStarLabel) == "table" and translatedStarLabel.txt then
translatedStarLabel = translateLanguage(translatedStarLabel.txt, translatedStarLabel.txt, true)
@/lua/ge/extensions/gameplay/rally/notebook/pacenote.lua
-- convert from old to new file format.
if type(langData.note) == "string" then
langData.note = {
@/lua/ge/extensions/editor/api/material.lua
if type(material) == "string" then
material = scenetree.findObject(material)
local function deleteMaterial(material)
if type(material) == "string" then
material = scenetree.findObject(material)
@/lua/ge/extensions/flowgraph/nodes/events/customizedTriggerBox.lua
local scl = self.pinIn.scale.value or 1
if type(scl) == 'table' then
trigger.scl = vec3(self.pinIn.scale.value)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/startScreenText.lua
local text = self.pinIn.text.value
if (type(text) == 'table' and text.txt == '') or text == '' then
text = nil
@/flowgraphEditor/Tower/customNodes/towerNode.lua
while c > #typeFiles do c = c - #typeFiles end
if type(elem.pick) == "number" then c =elem.pick end
local pick = typeFiles[c]
@/lua/common/jbeam/expressionParser.lua
local index = 0
local selectorType = type(selector)
local function includeExternalResource(resourceURI, sheetName, cellRef)
if type(resourceURI) ~= 'string' then return end
-- TODO: URL, URI, etc
local val = varWrapper.vars['$' .. v]
return type(val) == "table" and val.val or val
end,
local val = varWrapper.vars['$' .. key:sub(5)]
if type(val) == "table" then return val.val else return val end
end,
local val = varWrapper.vars['$' .. key:sub(5)]
if type(val) == "table" then return val.val else return val end
end,
@/lua/ge/extensions/ui/liveryEditor/selection.lua
local select = function(layerIds, highlight)
if type(layerIds) == "table" then
M.selectedLayers = layerIds
@/inspector/External/three.js/three.js
return new type( array ); // create typed array
@/ui/entrypoints/main/resourceLoader.js
*
* @param {string} type Element type (tag name)
* @param {object} [props={}] Properties for the element
@/lua/vehicle/sounds.lua
local soundscape = soundscapes[name]
return obj:createSFXSource2(soundscape.src, soundscape.descriptor or "AudioDefaultLoop3D", "", type(soundscape.node) == "number" and soundscape.node or M.refNode, 0)
end
local soundscape = soundscapes[name]
return type(soundscape.node) == "number" and soundscape.node or nil
end
if type(soundBank.sounds) == "table" then
--log('D', "sounds.loadSoundFiles", 'loaded '.. #soundBank.sounds .. ' sounds from directory ' .. directory)
for matId, event in pairs(scrapeMap) do
if type(event) == "string" then --this can be nil (if nothing exists for a given material) or a boolean/false (if disabled via jbeam)
if scrapeSounds[event] == nil then
for name, soundscape in pairs(soundscapes) do
bdebug.setNodeDebugText("Soundscape", type(soundscape.node) == "number" and soundscape.node or M.refNode, name .. ": " .. soundscape.src)
end
@/lua/vehicle/powertrain/torqueConverter.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/vehicle/props.lua
--convert any possible bools to 0/1
val = type(val) ~= "boolean" and val or (val and 1 or 0)
local pt = prop.translation
if prop.breakGroup ~= nil then
local breakGroups = type(prop.breakGroup) == "table" and prop.breakGroup or {prop.breakGroup}
for _, g in pairs(breakGroups) do
for _, g in pairs(breakGroups) do
if type(g) == "string" and g ~= "" then
if breakGroupMap[g] == nil then
if prop.deformGroup ~= nil then
local deformGroups = type(prop.deformGroup) == "table" and prop.deformGroup or {prop.deformGroup}
for _, g in pairs(deformGroups) do
for _, g in pairs(deformGroups) do
if type(g) == "string" and g ~= "" then
if deformGroupMap[g] == nil then
if prop.lightScaling then
if type(prop.lightScaling) ~= "table" then
prop.lightScaling = {
@/lua/ge/extensions/core/groundMarkers.lua
M.renderDecals = options.renderDecals ~= false
M.endWP = (type(wp) == 'table' and wp) or {wp}
if not wp or tableIsEmpty(M.endWP) then
for _, w in ipairs(M.endWP) do
if type(w) == 'string' then
if not map.getMap().nodes[w] then
end
elseif type(w) == 'table' and #w == 3 then
table.insert(multiPath, vec3(w))
@/lua/vehicle/powertrain/differential.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
if type(jbeamData.diffType) == "table" then
device.availableModes = shallowcopy(jbeamData.diffType)
@/lua/ge/extensions/gameplay/drag/general.lua
local status, ret = xpcall(function() return type(deserialize(vehicle.partConfig)) end, nop)
racer.stock = not ret
end
if not dials or type(dials) ~= 'table' or #dials == 0 then
return false
@/ui/lib/ext/angular-ui-router.min.js
*/
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return S(new(S(function(){},{prototype:a})),b)}function e(a){return R(arguments,function(b){b!==a&&R(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a){if(Object.keys)return Object.keys(a);var b=[];return R(a,function(a,c){b.push(c)}),b}function h(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=d<0?Math.ceil(d):Math.floor(d),d<0&&(d+=c);d=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return S({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e "));if(s[c]=d,O(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);R(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return P(a)&&a.then&&a.$$promises}if(!P(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return R(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!M(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;R(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!P(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=l;var n=a.defer(),r=n.promise,s=r.$$promises={},t=S({},d),u=1+q.length/3,v=!1;if(M(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,m(f.$$inheritedValues,p)),S(s,f.$$promises),f.$$values?(v=e(t,m(f.$$values,p)),r.$$inheritedValues=m(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=m(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;w=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash,s.isOptional),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function t(a){S(this,a)}function u(){function a(a){return null!=a?a.toString().replace(/(~|\/)/g,function(a){return{"~":"~~","/":"~2F"}[a]}):a}function e(a){return null!=a?a.toString().replace(/(~~|~2F)/g,function(a){return{"~~":"~","~2F":"/"}[a]}):a}function f(){return{strict:p,caseInsensitive:m}}function i(a){return N(a)||Q(a)&&N(a[a.length-1])}function j(){for(;w.length;){var a=w.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(r[a.name],l.invoke(a.def))}}function k(a){S(this,a||{})}V=this;var l,m=!1,p=!0,q=!1,r={},v=!0,w=[],x={string:{encode:a,decode:e,is:function(a){return null==a||!M(a)||"string"==typeof a},pattern:/[^\/]*/},int:{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return M(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/},json:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^\/]*/},any:{encode:b.identity,decode:b.identity,equals:b.equals,pattern:/.*/}};u.$$getDefaultValue=function(a){if(!i(a.value))return a.value;if(!l)throw new Error("Injectable functions cannot be called at configuration time");return l.invoke(a.value)},this.caseInsensitive=function(a){return M(a)&&(m=a),m},this.strictMode=function(a){return M(a)&&(p=a),p},this.defaultSquashPolicy=function(a){if(!M(a))return q;if(a!==!0&&a!==!1&&!O(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return q=a,a},this.compile=function(a,b){return new s(a,S(f(),b))},this.isMatcher=function(a){if(!P(a))return!1;var b=!0;return R(s.prototype,function(c,d){N(c)&&(b=b&&M(a[d])&&N(a[d]))}),b},this.type=function(a,b,c){if(!M(b))return r[a];if(r.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return r[a]=new t(S({name:a},b)),c&&(w.push({name:a,def:c}),v||j()),this},R(x,function(a,b){r[b]=new t(S({name:b},a))}),r=d(r,{}),this.$get=["$injector",function(a){return l=a,v=!1,j(),R(x,function(a,b){r[b]||(r[b]=new t(a))}),this}],this.Param=function(a,d,e,f){function j(a){var b=P(a)?g(a):[],c=h(b,"value")===-1&&h(b,"type")===-1&&h(b,"squash")===-1&&h(b,"array")===-1;return c&&(a={value:a}),a.$$fn=i(a.value)?a.value:function(){return a.value},a}function k(c,d,e){if(c.type&&d)throw new Error("Param '"+a+"' has two type configurations.");return d?d:c.type?b.isString(c.type)?r[c.type]:c.type instanceof t?c.type:new t(c.type):"config"===e?r.any:r.string}function m(){var b={array:"search"===f&&"auto"},c=a.match(/\[\]$/)?{array:!0}:{};return S(b,c,e).array}function p(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!M(c)||null==c)return q;if(c===!0||O(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function s(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=Q(a.replace)?a.replace:[],O(e)&&f.push({from:e,to:c}),g=o(f,function(a){return a.from}),n(i,function(a){return h(g,a.from)===-1}).concat(f)}function u(){if(!l)throw new Error("Injectable functions cannot be called at configuration time");var a=l.invoke(e.$$fn);if(null!==a&&a!==c&&!x.type.is(a))throw new Error("Default value ("+a+") for parameter '"+x.id+"' is not an instance of Type ("+x.type.name+")");return a}function v(a){function b(a){return function(b){return b.from===a}}function c(a){var c=o(n(x.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),M(a)?x.type.$normalize(a):u()}function w(){return"{Param:"+a+" "+d+" squash: '"+A+"' optional: "+z+"}"}var x=this;e=j(e),d=k(e,d,f);var y=m();d=y?d.$asArray(y,"search"===f):d,"string"!==d.name||y||"path"!==f||e.value!==c||(e.value="");var z=e.value!==c,A=p(e,z),B=s(e,y,z,A);S(this,{id:a,type:d,location:f,array:y,squash:A,replace:B,isOptional:z,value:v,dynamic:c,config:e,toString:w})},k.prototype={$$new:function(){return d(this,S(new k,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(k.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),R(b,function(b){R(g(b),function(b){h(a,b)===-1&&h(d,b)===-1&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return R(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return R(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var d,e,f,g,h,i=this.$$keys();for(d=0;d=0)throw new Error("State must have a valid name");if(A.hasOwnProperty(c))throw new Error("State '"+c+"' is already defined");var e=c.indexOf(".")!==-1?c.substring(0,c.lastIndexOf(".")):O(b.parent)?b.parent:P(b.parent)&&O(b.parent.name)?b.parent.name:"";if(e&&!A[e])return n(e,b.self);for(var f in D)N(D[f])&&(b[f]=D[f](b,D.$delegates[f]));return A[c]=b,!b[C]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){z.$current.navigable==b&&j(a,c)||z.transitionTo(b,a,{inherit:!0,location:!1})}]),q(c),b}function s(a){return a.indexOf("*")>-1}function t(a){for(var b=a.split("."),c=z.$current.name.split("."),d=0,e=b.length;d=A;d--)g=o[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=A;d2?k.enter(a,null,c).then(d):k.enter(a,null,c,d)},leave:function(a,c){b.version.minor>2?k.leave(a).then(c):k.leave(a,c)}};if(j){var e=j&&j(c,a);return{enter:function(a,b,c){e.enter(a,null,b),c()},leave:function(a,b){e.leave(a),b()}}}return d()}var i=g(),j=i("$animator"),k=i("$animate"),l={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,g,i){return function(c,g,j){function k(){if(m&&(m.remove(),m=null),o&&(o.$destroy(),o=null),n){var a=n.data("$uiViewAnim");s.leave(n,function(){a.$$animLeave.resolve(),m=null}),m=n,n=null}}function l(h){var l,m=B(c,j,g,e),t=m&&a.$current&&a.$current.locals[m];if(h||t!==p){l=c.$new(),p=a.$current.locals[m],l.$emit("$viewContentLoading",m);var u=i(l,function(a){var e=f.defer(),h=f.defer(),i={$animEnter:e.promise,$animLeave:h.promise,$$animLeave:h};a.data("$uiViewAnim",i),s.enter(a,g,function(){e.resolve(),o&&o.$emit("$viewContentAnimationEnded"),(b.isDefined(r)&&!r||c.$eval(r))&&d(a)}),k()});n=u,o=l,o.$emit("$viewContentLoaded",m),o.$eval(q)}}var m,n,o,p,q=j.onload||"",r=j.autoscroll,s=h(j,c);g.inheritedData("$uiView");c.$on("$stateChangeSuccess",function(){l(!1)}),l(!0)}}};return l}function A(a,c,d,e){return{restrict:"ECA",priority:-400,compile:function(f){var g=f.html();return function(f,h,i){var j=d.$current,k=B(f,i,h,e),l=j&&j.locals[k];if(l){h.data("$uiView",{name:k,state:l.$$state}),h.html(l.$template?l.$template:g);var m=b.extend({},l);f[l.$$resolveAs]=m;var n=a(h.contents());if(l.$$controller){l.$scope=f,l.$element=h;var o=c(l.$$controller,l);l.$$controllerAs&&(f[l.$$controllerAs]=o,f[l.$$controllerAs][l.$$resolveAs]=m),N(o.$onInit)&&o.$onInit(),h.data("$ngControllerController",o),h.children().data("$ngControllerController",o)}n(f)}}}}}function B(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function C(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function D(a){var b=a.parent().inheritedData("$uiView");if(b&&b.state&&b.state.name)return b.state}function E(a){var b="[object SVGAnimatedString]"===Object.prototype.toString.call(a.prop("href")),c="FORM"===a[0].nodeName;return{attr:c?"action":b?"xlink:href":"href",isAnchor:"A"===a.prop("tagName").toUpperCase(),clickable:!c}}function F(a,b,c,d,e){return function(f){var g=f.which||f.button,h=e();if(!(g>1||f.ctrlKey||f.metaKey||f.shiftKey||a.attr("target"))){var i=c(function(){b.go(h.state,h.params,h.options)});f.preventDefault();var j=d.isAnchor&&!h.href?1:0;f.preventDefault=function(){j--<=0&&c.cancel(i)}}}}function G(a,b){return{relative:D(a)||b.$current,inherit:!0}}function H(a,c){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(d,e,f,g){var h,i=C(f.uiSref,a.current.name),j={state:i.state,href:null,params:null},k=E(e),l=g[1]||g[0],m=null;j.options=S(G(e,a),f.uiSrefOpts?d.$eval(f.uiSrefOpts):{});var n=function(c){c&&(j.params=b.copy(c)),j.href=a.href(i.state,j.params,j.options),m&&m(),l&&(m=l.$$addStateInfo(i.state,j.params)),null!==j.href&&f.$set(k.attr,j.href)};i.paramExpr&&(d.$watch(i.paramExpr,function(a){a!==j.params&&n(a)},!0),j.params=b.copy(d.$eval(i.paramExpr))),n(),k.clickable&&(h=F(e,a,c,k,function(){return j}),e[e.on?"on":"bind"]("click",h),d.$on("$destroy",function(){e[e.off?"off":"unbind"]("click",h)}))}}}function I(a,b){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(c,d,e,f){function g(b){m.state=b[0],m.params=b[1],m.options=b[2],m.href=a.href(m.state,m.params,m.options),n&&n(),j&&(n=j.$$addStateInfo(m.state,m.params)),m.href&&e.$set(i.attr,m.href)}var h,i=E(d),j=f[1]||f[0],k=[e.uiState,e.uiStateParams||null,e.uiStateOpts||null],l="["+k.map(function(a){return a||"null"}).join(", ")+"]",m={state:null,params:null,options:null,href:null},n=null;c.$watch(l,g,!0),g(c.$eval(l)),i.clickable&&(h=F(d,a,b,i,function(){return m}),d[d.on?"on":"bind"]("click",h),c.$on("$destroy",function(){d[d.off?"off":"unbind"]("click",h)}))}}}function J(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(b,d,e,f){function g(b,c,e){var f=a.get(b,D(d)),g=h(b,c),i={state:f||{name:b},params:c,hash:g};return p.push(i),q[g]=e,function(){var a=p.indexOf(i);a!==-1&&p.splice(a,1)}}function h(a,c){if(!O(a))throw new Error("state should be a string");return P(c)?a+U(c):(c=b.$eval(c),P(c)?a+U(c):a)}function i(){for(var a=0;a0)){var c=g(a,b,o);return i(),c}},b.$on("$stateChangeSuccess",i),i()}]}}function K(a){var b=function(b,c){return a.is(b,c)};return b.$stateful=!0,b}function L(a){var b=function(b,c,d){return a.includes(b,c,d)};return b.$stateful=!0,b}var M=b.isDefined,N=b.isFunction,O=b.isString,P=b.isObject,Q=b.isArray,R=b.forEach,S=b.extend,T=b.copy,U=b.toJson;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),q.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",q),r.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",r);var V;s.prototype.concat=function(a,b){var c={caseInsensitive:V.caseInsensitive(),strict:V.strictMode(),squash:V.defaultSquashPolicy()};return new s(this.sourcePath+a+this.sourceSearch,S(c,b),this)},s.prototype.toString=function(){return this.source},s.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/g,"-")}var d=b(a).split(/-(?!\\)/),e=o(d,b);return o(e,c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,m;for(e=0;e
*/
"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="ui.router"),function(a,b,c){"use strict";function d(a,b){return S(new(S(function(){},{prototype:a})),b)}function e(a){return R(arguments,function(b){b!==a&&R(b,function(b,c){a.hasOwnProperty(c)||(a[c]=b)})}),a}function f(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function g(a){if(Object.keys)return Object.keys(a);var b=[];return R(a,function(a,c){b.push(c)}),b}function h(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=d<0?Math.ceil(d):Math.floor(d),d<0&&(d+=c);d=0||(k.push(e[m]),j[e[m]]=a[e[m]]);return S({},j,b)}function j(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e "));if(s[c]=d,O(a))q.push(c,[function(){return b.get(a)}],j);else{var e=b.annotate(a);R(e,function(a){a!==c&&i.hasOwnProperty(a)&&n(i[a],a)}),q.push(c,a,e)}r.pop(),s[c]=f}}function o(a){return P(a)&&a.then&&a.$$promises}if(!P(i))throw new Error("'invocables' must be an object");var p=g(i||{}),q=[],r=[],s={};return R(i,n),i=r=s=null,function(d,f,g){function h(){--u||(v||e(t,f.$$values),r.$$values=t,r.$$promises=r.$$promises||!0,delete r.$$inheritedValues,n.resolve(t))}function i(a){r.$$failure=a,n.reject(a)}function j(c,e,f){function j(a){l.reject(a),i(a)}function k(){if(!M(r.$$failure))try{l.resolve(b.invoke(e,g,t)),l.promise.then(function(a){t[c]=a,h()},j)}catch(a){j(a)}}var l=a.defer(),m=0;R(f,function(a){s.hasOwnProperty(a)&&!d.hasOwnProperty(a)&&(m++,s[a].then(function(b){t[a]=b,--m||k()},j))}),m||k(),s[c]=l.promise}if(o(d)&&g===c&&(g=f,f=d,d=null),d){if(!P(d))throw new Error("'locals' must be an object")}else d=k;if(f){if(!o(f))throw new Error("'parent' must be a promise returned by $resolve.resolve()")}else f=l;var n=a.defer(),r=n.promise,s=r.$$promises={},t=S({},d),u=1+q.length/3,v=!1;if(M(f.$$failure))return i(f.$$failure),r;f.$$inheritedValues&&e(t,m(f.$$inheritedValues,p)),S(s,f.$$promises),f.$$values?(v=e(t,m(f.$$values,p)),r.$$inheritedValues=m(f.$$values,p),h()):(f.$$inheritedValues&&(r.$$inheritedValues=m(f.$$inheritedValues,p)),f.then(h,i));for(var w=0,x=q.length;w=0));)s=f(r.id,r.type,r.cfg,"path"),l+=g(r.segment,s.type.pattern.source,s.squash,s.isOptional),n.push(r.segment),m=j.lastIndex;t=a.substring(m);var u=t.indexOf("?");if(u>=0){var v=this.sourceSearch=t.substring(u);if(t=t.substring(0,u),this.sourcePath=a.substring(0,m+u),v.length>0)for(m=0;i=k.exec(v);)r=h(i,!0),s=f(r.id,r.type,r.cfg,"search"),m=j.lastIndex}else this.sourcePath=a,this.sourceSearch="";l+=g(t)+(b.strict===!1?"/?":"")+"$",n.push(t),this.regexp=new RegExp(l,b.caseInsensitive?"i":c),this.prefix=n[0],this.$$paramNames=q}function t(a){S(this,a)}function u(){function a(a){return null!=a?a.toString().replace(/(~|\/)/g,function(a){return{"~":"~~","/":"~2F"}[a]}):a}function e(a){return null!=a?a.toString().replace(/(~~|~2F)/g,function(a){return{"~~":"~","~2F":"/"}[a]}):a}function f(){return{strict:p,caseInsensitive:m}}function i(a){return N(a)||Q(a)&&N(a[a.length-1])}function j(){for(;w.length;){var a=w.shift();if(a.pattern)throw new Error("You cannot override a type's .pattern at runtime.");b.extend(r[a.name],l.invoke(a.def))}}function k(a){S(this,a||{})}V=this;var l,m=!1,p=!0,q=!1,r={},v=!0,w=[],x={string:{encode:a,decode:e,is:function(a){return null==a||!M(a)||"string"==typeof a},pattern:/[^\/]*/},int:{encode:a,decode:function(a){return parseInt(a,10)},is:function(a){return M(a)&&this.decode(a.toString())===a},pattern:/\d+/},bool:{encode:function(a){return a?1:0},decode:function(a){return 0!==parseInt(a,10)},is:function(a){return a===!0||a===!1},pattern:/0|1/},date:{encode:function(a){return this.is(a)?[a.getFullYear(),("0"+(a.getMonth()+1)).slice(-2),("0"+a.getDate()).slice(-2)].join("-"):c},decode:function(a){if(this.is(a))return a;var b=this.capture.exec(a);return b?new Date(b[1],b[2]-1,b[3]):c},is:function(a){return a instanceof Date&&!isNaN(a.valueOf())},equals:function(a,b){return this.is(a)&&this.is(b)&&a.toISOString()===b.toISOString()},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/},json:{encode:b.toJson,decode:b.fromJson,is:b.isObject,equals:b.equals,pattern:/[^\/]*/},any:{encode:b.identity,decode:b.identity,equals:b.equals,pattern:/.*/}};u.$$getDefaultValue=function(a){if(!i(a.value))return a.value;if(!l)throw new Error("Injectable functions cannot be called at configuration time");return l.invoke(a.value)},this.caseInsensitive=function(a){return M(a)&&(m=a),m},this.strictMode=function(a){return M(a)&&(p=a),p},this.defaultSquashPolicy=function(a){if(!M(a))return q;if(a!==!0&&a!==!1&&!O(a))throw new Error("Invalid squash policy: "+a+". Valid policies: false, true, arbitrary-string");return q=a,a},this.compile=function(a,b){return new s(a,S(f(),b))},this.isMatcher=function(a){if(!P(a))return!1;var b=!0;return R(s.prototype,function(c,d){N(c)&&(b=b&&M(a[d])&&N(a[d]))}),b},this.type=function(a,b,c){if(!M(b))return r[a];if(r.hasOwnProperty(a))throw new Error("A type named '"+a+"' has already been defined.");return r[a]=new t(S({name:a},b)),c&&(w.push({name:a,def:c}),v||j()),this},R(x,function(a,b){r[b]=new t(S({name:b},a))}),r=d(r,{}),this.$get=["$injector",function(a){return l=a,v=!1,j(),R(x,function(a,b){r[b]||(r[b]=new t(a))}),this}],this.Param=function(a,d,e,f){function j(a){var b=P(a)?g(a):[],c=h(b,"value")===-1&&h(b,"type")===-1&&h(b,"squash")===-1&&h(b,"array")===-1;return c&&(a={value:a}),a.$$fn=i(a.value)?a.value:function(){return a.value},a}function k(c,d,e){if(c.type&&d)throw new Error("Param '"+a+"' has two type configurations.");return d?d:c.type?b.isString(c.type)?r[c.type]:c.type instanceof t?c.type:new t(c.type):"config"===e?r.any:r.string}function m(){var b={array:"search"===f&&"auto"},c=a.match(/\[\]$/)?{array:!0}:{};return S(b,c,e).array}function p(a,b){var c=a.squash;if(!b||c===!1)return!1;if(!M(c)||null==c)return q;if(c===!0||O(c))return c;throw new Error("Invalid squash policy: '"+c+"'. Valid policies: false, true, or arbitrary string")}function s(a,b,d,e){var f,g,i=[{from:"",to:d||b?c:""},{from:null,to:d||b?c:""}];return f=Q(a.replace)?a.replace:[],O(e)&&f.push({from:e,to:c}),g=o(f,function(a){return a.from}),n(i,function(a){return h(g,a.from)===-1}).concat(f)}function u(){if(!l)throw new Error("Injectable functions cannot be called at configuration time");var a=l.invoke(e.$$fn);if(null!==a&&a!==c&&!x.type.is(a))throw new Error("Default value ("+a+") for parameter '"+x.id+"' is not an instance of Type ("+x.type.name+")");return a}function v(a){function b(a){return function(b){return b.from===a}}function c(a){var c=o(n(x.replace,b(a)),function(a){return a.to});return c.length?c[0]:a}return a=c(a),M(a)?x.type.$normalize(a):u()}function w(){return"{Param:"+a+" "+d+" squash: '"+A+"' optional: "+z+"}"}var x=this;e=j(e),d=k(e,d,f);var y=m();d=y?d.$asArray(y,"search"===f):d,"string"!==d.name||y||"path"!==f||e.value!==c||(e.value="");var z=e.value!==c,A=p(e,z),B=s(e,y,z,A);S(this,{id:a,type:d,location:f,array:y,squash:A,replace:B,isOptional:z,value:v,dynamic:c,config:e,toString:w})},k.prototype={$$new:function(){return d(this,S(new k,{$$parent:this}))},$$keys:function(){for(var a=[],b=[],c=this,d=g(k.prototype);c;)b.push(c),c=c.$$parent;return b.reverse(),R(b,function(b){R(g(b),function(b){h(a,b)===-1&&h(d,b)===-1&&a.push(b)})}),a},$$values:function(a){var b={},c=this;return R(c.$$keys(),function(d){b[d]=c[d].value(a&&a[d])}),b},$$equals:function(a,b){var c=!0,d=this;return R(d.$$keys(),function(e){var f=a&&a[e],g=b&&b[e];d[e].type.equals(f,g)||(c=!1)}),c},$$validates:function(a){var d,e,f,g,h,i=this.$$keys();for(d=0;d=0)throw new Error("State must have a valid name");if(A.hasOwnProperty(c))throw new Error("State '"+c+"' is already defined");var e=c.indexOf(".")!==-1?c.substring(0,c.lastIndexOf(".")):O(b.parent)?b.parent:P(b.parent)&&O(b.parent.name)?b.parent.name:"";if(e&&!A[e])return n(e,b.self);for(var f in D)N(D[f])&&(b[f]=D[f](b,D.$delegates[f]));return A[c]=b,!b[C]&&b.url&&a.when(b.url,["$match","$stateParams",function(a,c){z.$current.navigable==b&&j(a,c)||z.transitionTo(b,a,{inherit:!0,location:!1})}]),q(c),b}function s(a){return a.indexOf("*")>-1}function t(a){for(var b=a.split("."),c=z.$current.name.split("."),d=0,e=b.length;d=A;d--)g=o[d],g.self.onExit&&h.invoke(g.self.onExit,g.self,g.locals.globals),g.locals=null;for(d=A;d2?k.enter(a,null,c).then(d):k.enter(a,null,c,d)},leave:function(a,c){b.version.minor>2?k.leave(a).then(c):k.leave(a,c)}};if(j){var e=j&&j(c,a);return{enter:function(a,b,c){e.enter(a,null,b),c()},leave:function(a,b){e.leave(a),b()}}}return d()}var i=g(),j=i("$animator"),k=i("$animate"),l={restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(c,g,i){return function(c,g,j){function k(){if(m&&(m.remove(),m=null),o&&(o.$destroy(),o=null),n){var a=n.data("$uiViewAnim");s.leave(n,function(){a.$$animLeave.resolve(),m=null}),m=n,n=null}}function l(h){var l,m=B(c,j,g,e),t=m&&a.$current&&a.$current.locals[m];if(h||t!==p){l=c.$new(),p=a.$current.locals[m],l.$emit("$viewContentLoading",m);var u=i(l,function(a){var e=f.defer(),h=f.defer(),i={$animEnter:e.promise,$animLeave:h.promise,$$animLeave:h};a.data("$uiViewAnim",i),s.enter(a,g,function(){e.resolve(),o&&o.$emit("$viewContentAnimationEnded"),(b.isDefined(r)&&!r||c.$eval(r))&&d(a)}),k()});n=u,o=l,o.$emit("$viewContentLoaded",m),o.$eval(q)}}var m,n,o,p,q=j.onload||"",r=j.autoscroll,s=h(j,c);g.inheritedData("$uiView");c.$on("$stateChangeSuccess",function(){l(!1)}),l(!0)}}};return l}function A(a,c,d,e){return{restrict:"ECA",priority:-400,compile:function(f){var g=f.html();return function(f,h,i){var j=d.$current,k=B(f,i,h,e),l=j&&j.locals[k];if(l){h.data("$uiView",{name:k,state:l.$$state}),h.html(l.$template?l.$template:g);var m=b.extend({},l);f[l.$$resolveAs]=m;var n=a(h.contents());if(l.$$controller){l.$scope=f,l.$element=h;var o=c(l.$$controller,l);l.$$controllerAs&&(f[l.$$controllerAs]=o,f[l.$$controllerAs][l.$$resolveAs]=m),N(o.$onInit)&&o.$onInit(),h.data("$ngControllerController",o),h.children().data("$ngControllerController",o)}n(f)}}}}}function B(a,b,c,d){var e=d(b.uiView||b.name||"")(a),f=c.inheritedData("$uiView");return e.indexOf("@")>=0?e:e+"@"+(f?f.state.name:"")}function C(a,b){var c,d=a.match(/^\s*({[^}]*})\s*$/);if(d&&(a=b+"("+d[1]+")"),c=a.replace(/\n/g," ").match(/^([^(]+?)\s*(\((.*)\))?$/),!c||4!==c.length)throw new Error("Invalid state ref '"+a+"'");return{state:c[1],paramExpr:c[3]||null}}function D(a){var b=a.parent().inheritedData("$uiView");if(b&&b.state&&b.state.name)return b.state}function E(a){var b="[object SVGAnimatedString]"===Object.prototype.toString.call(a.prop("href")),c="FORM"===a[0].nodeName;return{attr:c?"action":b?"xlink:href":"href",isAnchor:"A"===a.prop("tagName").toUpperCase(),clickable:!c}}function F(a,b,c,d,e){return function(f){var g=f.which||f.button,h=e();if(!(g>1||f.ctrlKey||f.metaKey||f.shiftKey||a.attr("target"))){var i=c(function(){b.go(h.state,h.params,h.options)});f.preventDefault();var j=d.isAnchor&&!h.href?1:0;f.preventDefault=function(){j--<=0&&c.cancel(i)}}}}function G(a,b){return{relative:D(a)||b.$current,inherit:!0}}function H(a,c){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(d,e,f,g){var h,i=C(f.uiSref,a.current.name),j={state:i.state,href:null,params:null},k=E(e),l=g[1]||g[0],m=null;j.options=S(G(e,a),f.uiSrefOpts?d.$eval(f.uiSrefOpts):{});var n=function(c){c&&(j.params=b.copy(c)),j.href=a.href(i.state,j.params,j.options),m&&m(),l&&(m=l.$$addStateInfo(i.state,j.params)),null!==j.href&&f.$set(k.attr,j.href)};i.paramExpr&&(d.$watch(i.paramExpr,function(a){a!==j.params&&n(a)},!0),j.params=b.copy(d.$eval(i.paramExpr))),n(),k.clickable&&(h=F(e,a,c,k,function(){return j}),e[e.on?"on":"bind"]("click",h),d.$on("$destroy",function(){e[e.off?"off":"unbind"]("click",h)}))}}}function I(a,b){return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(c,d,e,f){function g(b){m.state=b[0],m.params=b[1],m.options=b[2],m.href=a.href(m.state,m.params,m.options),n&&n(),j&&(n=j.$$addStateInfo(m.state,m.params)),m.href&&e.$set(i.attr,m.href)}var h,i=E(d),j=f[1]||f[0],k=[e.uiState,e.uiStateParams||null,e.uiStateOpts||null],l="["+k.map(function(a){return a||"null"}).join(", ")+"]",m={state:null,params:null,options:null,href:null},n=null;c.$watch(l,g,!0),g(c.$eval(l)),i.clickable&&(h=F(d,a,b,i,function(){return m}),d[d.on?"on":"bind"]("click",h),c.$on("$destroy",function(){d[d.off?"off":"unbind"]("click",h)}))}}}function J(a,b,c){return{restrict:"A",controller:["$scope","$element","$attrs","$timeout",function(b,d,e,f){function g(b,c,e){var f=a.get(b,D(d)),g=h(b,c),i={state:f||{name:b},params:c,hash:g};return p.push(i),q[g]=e,function(){var a=p.indexOf(i);a!==-1&&p.splice(a,1)}}function h(a,c){if(!O(a))throw new Error("state should be a string");return P(c)?a+U(c):(c=b.$eval(c),P(c)?a+U(c):a)}function i(){for(var a=0;a0)){var c=g(a,b,o);return i(),c}},b.$on("$stateChangeSuccess",i),i()}]}}function K(a){var b=function(b,c){return a.is(b,c)};return b.$stateful=!0,b}function L(a){var b=function(b,c,d){return a.includes(b,c,d)};return b.$stateful=!0,b}var M=b.isDefined,N=b.isFunction,O=b.isString,P=b.isObject,Q=b.isArray,R=b.forEach,S=b.extend,T=b.copy,U=b.toJson;b.module("ui.router.util",["ng"]),b.module("ui.router.router",["ui.router.util"]),b.module("ui.router.state",["ui.router.router","ui.router.util"]),b.module("ui.router",["ui.router.state"]),b.module("ui.router.compat",["ui.router"]),q.$inject=["$q","$injector"],b.module("ui.router.util").service("$resolve",q),r.$inject=["$http","$templateCache","$injector"],b.module("ui.router.util").service("$templateFactory",r);var V;s.prototype.concat=function(a,b){var c={caseInsensitive:V.caseInsensitive(),strict:V.strictMode(),squash:V.defaultSquashPolicy()};return new s(this.sourcePath+a+this.sourceSearch,S(c,b),this)},s.prototype.toString=function(){return this.source},s.prototype.exec=function(a,b){function c(a){function b(a){return a.split("").reverse().join("")}function c(a){return a.replace(/\\-/g,"-")}var d=b(a).split(/-(?!\\)/),e=o(d,b);return o(e,c).reverse()}var d=this.regexp.exec(a);if(!d)return null;b=b||{};var e,f,g,h=this.parameters(),i=h.length,j=this.segments.length-1,k={};if(j!==d.length-1)throw new Error("Unbalanced capture group in route '"+this.source+"'");var l,m;for(e=0;e
@/lua/vehicle/controller/propAnimation/dualAxisLever.lua
-- ignore any non string values here (like from a manual transmission)
if not desiredMode or type(desiredMode) ~= "string" or desiredMode == "" then
return
if type(jbeamData.moveSoundNode_nodes) == "table" and jbeamData.moveSoundNode_nodes[1] and type(jbeamData.moveSoundNode_nodes[1]) == "number" then
moveSoundNodeId = jbeamData.moveSoundNode_nodes[1]
if type(jbeamData.moveSoundNode_nodes) == "table" and jbeamData.moveSoundNode_nodes[1] and type(jbeamData.moveSoundNode_nodes[1]) == "number" then
moveSoundNodeId = jbeamData.moveSoundNode_nodes[1]
@/lua/common/tech/pcdLib.lua
local function fieldToStr(x)
if type(x) == 'table' then
return table.concat(x, ' ')
@/lua/ge/extensions/gameplay/parking.lua
local function setSites(data) -- sets sites data, can override the default sites data
if type(data) == "string" then
if FS:fileExists(data) then
end
elseif type(data) == "table" and data.parkingSpots then -- assuming that given data is valid sites data
sites = data
local function updateParkingSpots(psList, pos) -- updates the distances of the parking spots in the cached list
if not psList or type(psList[1]) ~= "table" then return psList end
for i, v in ipairs(psList) do
local function filterParkingSpots(psList, filters) -- filter the sorted list of parking spots (as returned by findParkingSpots)
if not psList or type(psList[1]) ~= "table" then return psList end
filters = filters or defaultFilters
local prob = ps.customFields:has("probability") and ps.customFields:get("probability") or vars.baseProbability
if type(prob) ~= "number" then prob = 1 end
prob = prob * vars.baseProbability
if reset then resetParkingVars() end
if type(data) ~= "table" then return end
local group
if type(options.vehGroup) == "table" then
group = options.vehGroup
@/lua/common/event.lua
local function is_function(fun)
if fun and type(fun) == 'function' then
return true
@/lua/ge/main.lua
Lua:log(a, b, c, ...)
if (type(a) == "string" and string.len(a) > 1000) or
(type(b) == "string" and string.len(b) > 1000) or
if (type(a) == "string" and string.len(a) > 1000) or
(type(b) == "string" and string.len(b) > 1000) or
(type(c) == "string" and string.len(c) > 1000) ) then
(type(b) == "string" and string.len(b) > 1000) or
(type(c) == "string" and string.len(c) > 1000) ) then
log("W", b, "The long log message above has been triggered by:")
local extName = extension
if type(extension) == 'table' then
extName = extension.__extensionName__
if type(extName) ~= 'string' then
log('E','','Failed to set unload mode "'..dumps(unloadMode)..'" due to unrecognized extension: '..dumps(extension))
if type(callback) == 'function' then
callback()
-- don't have a single CS file responding to this message. We should delete it.
-- if scripts_main.onPreStart and type(scripts_main.onPreStart) == 'function' then
-- scripts_main.onPreStart()
@/lua/ge/extensions/campaign/rewards.lua
local function processEntry(earned, k, data)
if type(data) == 'table' then
earned[k] = earned[k] or {}
if subKey == 'choices' then
if type(value) == 'table' then
pendingChoice['choices'] = value
-- local eventData = scenarioData.onEvent[eventName]
-- if eventData.rewards and type(eventData.rewards) == 'table' then
-- local result = {}
@/lua/ge/extensions/core/vehicles.lua
elseif tableContains(convertToRange, key) then
if type(data[key]) == 'number' then
if not destination[key] then
end
if type(value) == 'string' then
destination[key][value] = true
end
if type(value) == 'table' then
for value, active in pairs(value or {}) do
if type(value) == 'table' then
for _, value2 in ipairs(value) do
for key, value in pairs(data) do
if shouldBeStringLookup[key] and type(value) ~= "string" then
log('W', '', 'Info file '..filepath..' has a non-string value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to string.')
if shouldBeStringLookup[key] and type(value) ~= "string" then
log('W', '', 'Info file '..filepath..' has a non-string value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to string.')
newData[key] = tostring(value)
end
if shouldBeNumberLookup[key] and type(value) ~= "number" then
newData[key] = tonumber(value)
if newData[key] == nil then
log('E', '', 'Info file '..filepath..' has a non-number value for key '..key..': '..dumps(value)..'('..type(value)..') that could not be converted to a number.')
else
else
log('W', '', 'Info file '..filepath..' has a non-number value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to number.')
end
if shouldBeDictLookup[key] then
if type(value) ~= "table" then
--log('W', '', 'Info file '..filepath..' has a non-table value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to table.')
if type(value) ~= "table" then
--log('W', '', 'Info file '..filepath..' has a non-table value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to table.')
newData[key] = { [value] = true }
if key == "Years" then
if type(value) == "string" then
newData[key] = tostring(value)
if newData[key] == nil then
log('E', '', 'Info file '..filepath..' has a invalid value for key '..key..': '..dumps(value)..'('..type(value)..') that could not be converted to a string.')
else
else
log('W', '', 'Info file '..filepath..' has a invalid value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to string.')
end
end
elseif type(value) == "table" and (type(value.min) ~= "number" or type(value.max) ~= "number") then
newData[key] = {min = tonumber(value.min), max = tonumber(value.max)}
end
elseif type(value) == "table" and (type(value.min) ~= "number" or type(value.max) ~= "number") then
newData[key] = {min = tonumber(value.min), max = tonumber(value.max)}
end
elseif type(value) == "table" and (type(value.min) ~= "number" or type(value.max) ~= "number") then
newData[key] = {min = tonumber(value.min), max = tonumber(value.max)}
if newData[key].min == nil or newData[key].max == nil then
log('E', '', 'Info file '..filepath..' has a invalid value for key '..key..': '..dumps(value)..'('..type(value)..') that could not be converted to a number.')
else
else
log('W', '', 'Info file '..filepath..' has a invalid value for key '..key..': '..dumps(value)..'('..type(value)..'). Converting to number.')
end
for name, data in pairs(info.colors or {}) do
if type(data) == 'string' then
local colorTable = stringToTable(data)
for _, key in ipairs(default_color_keys) do
if info[key] and type(info[key]) == 'table' and #info[key] == 4 then
log("W","", "Outdated default color format in "..dumps(infoFilename)..". Converting to paint: "..dumps(info[key]))
if type(key) ~= 'string' then return nil end
local vehFiles = getModelsData()[key]
for name, data in pairs(readData.paints or {}) do
if type(data) ~= 'table' then
log("E","","Invalid paint setup in "..dumps(infoFilename)..". Paint "..dumps(name).." is not a valid paint: "..dumps(data))
local function getModel(key)
if type(key) ~= 'string' then return {} end
local modelsData = getModelsData()[key]
for name, data in pairs(data.paints or {}) do
if type(data) ~= 'table' then
log("E","","Invalid paint setup in "..dumps(infoFilename)..". Paint "..dumps(name).." is not a valid paint: "..dumps(data))
for key,_ in pairs(propVal) do
if type(key) == 'table' then
for _, key2 in pairs(key) do
opts.config = 'vehicles/' .. modelName .. '/' .. model.model.default_pc .. '.pc'
elseif type(opts.config) == 'string' and not string.find(opts.config, '.pc') and FS:fileExists('/vehicles/' .. modelName .. '/' .. opts.config .. '.pc') then
opts.config = 'vehicles/' .. modelName .. '/' .. opts.config .. '.pc'
if type(opts.config) == 'string' and opts.config ~= '' and not string.find(opts.config, '{') then
-- if we provide a pc file: can be a basename or a full path
elseif type(opts.config) == 'table' and opts.config.format == 4 then
--return
if type(config) == 'table' and config.linkedPCFile then
localOptions.config = config.linkedPCFile
if type(config) == 'table' and config.linkedPCFile then
localOptions.config = config.linkedPCFile
if newVeh then
if type(newVeh) == 'table' then
for _, veh in ipairs(newVeh) do
if type(vehs) == 'table' then
return vehs[1], vehs
if type(vehs) == 'table' then
return vehs[1], vehs
local strtmp = designData.gen.pattern
if type(strtmp) == "table" then
strtmp = strtmp[random(1, #strtmp)]
for k,fn in pairs(designData.gen.patternData) do
if type(fn) == "table" then
local tmpfn = function() return fn[random(1, #fn)] end --return one random for each use instead of same
veh = veh or getPlayerVehicle(0)
if type(veh) == 'number' then
veh = getObjectByID(veh)
if type(data.vehicles) == "table" and next(data.vehicles) then
local visitedDirs = {}
if type(data.vehicles) == "table" and next(data.vehicles) then
local visitedDirs = {}
return true
elseif type(maybeVehicle) == "table" then
loadCustomVehicle(unpack(maybeVehicle))
@/lua/ge/extensions/editor/gen/utils.lua
local function fromJSON(t)
if type(t) == 'table' then
if t.x and t.y then
for o,e in pairs(t) do
-- lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
t[o] = U.fromJSON(e)
for o,e in pairs(t) do
-- lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
t[o] = U.fromJSON(e)
return t
-- lo('?? dump_nn:'..type(t)..':'..tostring(t))
-- return tostring(t)
if not lvl or lvl == true then lvl = 0 end
-- lo('?? dump:'..tostring(lvl)..':'..type(t))
if not t then
end
if type(t) == 'table' then
local s = '{ '
for o,e in pairs(t) do
-- lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
local lt = U.dump(e, nil, lvl+1, lvlma)
for o,e in pairs(t) do
-- lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
local lt = U.dump(e, nil, lvl+1, lvlma)
else
-- lo('?? dump_nn:'..type(t)..':'..tostring(t))
return tostring(t)
local ret = {}
local isprop = type(cb) == 'string'
for k,v in pairs(list) do
local function mod(ai, n)
if type(n) == 'table' then
if type(ai) == 'table' then
if type(n) == 'table' then
if type(ai) == 'table' then
elseif ai then
else
if type(ai) == 'table' then
for o,i in pairs(ai) do
if not ndig then ndig = 4 end
-- lo('?? v2stamp:'..type(v))
local isvec = type(v) == 'cdata'
-- lo('?? v2stamp:'..type(v))
local isvec = type(v) == 'cdata'
local s = ''
@/lua/vehicle/controller/hydraulics/electricHydraulics.lua
for _, electric in ipairs(electricsNames) do
if type(electrics.values[electric]) == "number" and abs(electrics.values[electric]) > 0 then
motorThrottle = 1
local function init(jbeamData)
electricsNames = type(jbeamData.controlElectricsName) ~= "table" and {jbeamData.controlElectricsName} or jbeamData.controlElectricsName
motorThrottleElectric = jbeamData.motorThrottleElectricsName
@/lua/ge/extensions/career/modules/insurance/insurance.lua
vehInvId = vehInvId or career_modules_inventory.getCurrentVehicle()
repairOptionData = (repairOptionData and type(repairOptionData) == "table") and repairOptionData or {}
@/lua/ge/extensions/util/jbeamStats.lua
if type(part.slotType) == 'string' and part.slotType == 'main' then
totalRootParts = totalRootParts + 1
if type(section) == 'table' and section[1] then
local countedRows = 0
for _, row in pairs(section) do
if type(row) == 'table' and row[1] then
countedRows = countedRows + 1
@/lua/common/libs/inspect/inspect.lua
local function isIdentifier(str)
return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" )
end
local function isSequenceKey(k, sequenceLength)
return type(k) == 'number'
and 1 <= k
local function sortKeys(a, b)
local ta, tb = type(a), type(b)
local function sortKeys(a, b)
local ta, tb = type(a), type(b)
if type(t) == 'table' then
if not tableAppearances[t] then
local processed = process(item, path)
if type(processed) == 'table' then
local processedCopy = {}
local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited)
if type(mt) ~= 'table' then mt = nil end -- ignore not nil/table __metatable field
setmetatable(processedCopy, mt)
if not id then
local tv = type(v)
id = (self.maxIds[tv] or 0) + 1
if type(mt) == 'table' then
if count > 0 then self:puts(',') end
if nonSequentialKeysLength > 0 or type(mt) == 'table' then -- result is multi-lined. Justify closing }
self:tabify()
function Inspector:putValue(v)
local tv = type(v)
@/inspector/Models/IssueMessage.js
get text() { return this._text; }
get type() { return this._type; }
get level() { return this._consoleMessage.level; }
@/lua/vehicle/powertrain/supercharger.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
for k, v in pairs(jbeamData.boostController) do
if type(k) == "number" then
tipoints[tipointsidx] = {v[1], v[2]}
for k, _ in pairs(assignedEngine.torqueCurve) do
if type(k) == "number" and k < assignedEngine.maxRPM then
local engage = min(max((k - clutchEngageRPM) * invClutchEngageRange, 0), 1) --min 1000, range 100
@/lua/ge/extensions/util/wsTest.lua
if func then
if type(debug.traceback) ~= "function" then
print("*** LUA TRACEBACK BROKEN ***")
@/lua/vehicle/extensions/tech/platooning.lua
for k, v in pairs(simData) do
if type(v) == "table" then
if k =="closestVehicles1" then -- closest detected vehicle
if k2 == "velBB" then
if type(v2) == "cdata" then
local x = tonumber(v2.x)
@/lua/ge/extensions/core/weather.lua
formerValues[objClassStr][id][attrName] = {}
if fields[attrName].type == 'int' or fields[attrName].type == 'float' and type(attrValue) == 'number' then
formerValues[objClassStr][id][attrName]['value'] = obj[attrName]
formerValues[objClassStr][id][attrName]['setter'] = setNumber
elseif fields[attrName].type == 'ColorF' and type(attrValue) == 'table' and #attrValue == 4 then
formerValues[objClassStr][id][attrName]['value'] = stringToTable(obj:getField(attrName, ' '))
formerValues[objClassStr][id][attrName]['setter'] = setColor4F
elseif fields[attrName].type == 'Point4F' and type(attrValue) == 'table' and #attrValue == 4 then
formerValues[objClassStr][id][attrName]['value'] = stringToTable(obj:getField(attrName, ' '))
formerValues[objClassStr][id][attrName]['setter'] = setPoint4F
elseif (fields[attrName].type == 'Point3F' or fields[attrName].type == 'vec3') and type(attrValue) == 'table' and #attrValue == 3 then
formerValues[objClassStr][id][attrName]['value'] = stringToTable(obj:getField(attrName, ' '))
formerValues[objClassStr][id][attrName]['setter'] = setVec3
elseif type(attrValue) == 'string' then
formerValues[objClassStr][id][attrName] = obj[attrName]
for attrName, attrVal in pairs(obj) do
if type(attrVal.value) == 'number' and p[objClassStr][attrName] ~= nil then
diff[objClassStr][id][attrName] = (p[objClassStr][attrName] - attrVal.value)
diff[objClassStr][id][attrName] = (p[objClassStr][attrName] - attrVal.value)
elseif type(attrVal.value) == 'table' and p[objClassStr][attrName] ~= nil then
diff[objClassStr][id][attrName] = diffTable(p[objClassStr][attrName], attrVal.value)
for objClassStr, attribTable in pairs(p) do
if type(objClassStr) ~= 'string' or type(attribTable) ~= 'table' then
log('E', 'weather', 'object class or attrib table invalid: ' .. tostring(objClassStr))
for objClassStr, attribTable in pairs(p) do
if type(objClassStr) ~= 'string' or type(attribTable) ~= 'table' then
log('E', 'weather', 'object class or attrib table invalid: ' .. tostring(objClassStr))
local fields = obj:getFields()
if type(fields[attrName]) ~= 'table' then
log('E', 'weather', 'object attribute invalid: class = ' .. tostring(objClassStr) .. ', attribute = ' .. tostring(attrName))
local val = nil
if type(attrValue) == fields[attrName].type then
val = attrValue
val = attrValue
elseif (fields[attrName].type == 'filename' or fields[attrName].type == 'annotation') and type(attrValue) == 'string' then
val = attrValue
val = attrValue
elseif (fields[attrName].type == 'float' or fields[attrName].type == 'int') and type(attrValue) == 'number' then
val = attrValue
val = attrValue
elseif fields[attrName].type == 'bool' and type(attrValue) == 'boolean' then
val = attrValue
val = attrValue
elseif fields[attrName].type == 'ColorF' and type(attrValue) == 'table' and #attrValue == 4 then
val = Point4F(attrValue[1], attrValue[2], attrValue[3], attrValue[4])
val = Point4F(attrValue[1], attrValue[2], attrValue[3], attrValue[4])
elseif fields[attrName].type == 'Point4F' and type(attrValue) == 'table' and #attrValue == 4 then
val = Point4F(attrValue[1], attrValue[2], attrValue[3], attrValue[4])
val = Point4F(attrValue[1], attrValue[2], attrValue[3], attrValue[4])
elseif (fields[attrName].type == 'Point3F' or fields[attrName].type == 'vec3') and type(attrValue) == 'table' and #attrValue == 3 then
val = vec3(attrValue[1], attrValue[2], attrValue[3])
local levelPath = getMissionFilename() -- /levels/small_island/info.json
if type(levelPath) ~= 'string' or string.len(levelPath) == 0 then return end
@/lua/common/extensions/ui/flowgraph/editor.lua
end
if tpe == nil or type(tpe) == 'table' or tpe == 'any' then
-- guess type
-- guess type
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
-- guess type
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
-- guess type
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
elseif type(value) == 'table' then
tpe = type(value)
elseif type(value) == 'table' then
if #value == 3 then
end
if tpe == nil or type(tpe) == 'table' or tpe == 'any' then
-- guess type
-- guess type
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
-- guess type
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
-- guess type
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
if type(value) == 'boolean' or type(value) == 'string' or type(value) == 'number' then
tpe = type(value)
elseif type(value) == 'table' then
tpe = type(value)
elseif type(value) == 'table' then
if #value == 3 then
@/lua/ge/extensions/util/export.lua
for k,v in ipairs(binaryBuffers) do
if type(v.data) == 'cdata' then
-- ffi buffer
f:write(ffi.string(v.data, v.len))
elseif type(v.data) == 'string' then
-- normal lua buffer
else
log('E', logTag, 'unknown buffer type: ' .. type(v.data))
end
@/lua/ge/extensions/ui/vehicleSelector/tileGrouping.lua
local price = value
if type(value) == 'table' then
price = value.min
@/lua/ge/extensions/render/openxr.lua
end
if type(err) ~= "string" then
translationId = "unkownType"
translationId = "unkownType"
log("E", "", string.format("An OpenXR error was detected, but a wrong error type was passed: %s ('%s')", type(err), dumps(err)))
end
@/lua/ge/extensions/statistics/statistics.lua
if statData and type(statData) ~= 'table' then
return
end
-- log('D', logTag, vehicleName ..': Damage type: '..type(statsProperties['damage']) ..' Size: '..#damageProperties)
@/lua/common/luaBinding.lua
local getFunc = rawget(getters, k)
if type(getFunc) == 'function' then
-- log('E', '', ' getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
-- log('E', '', ' getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
if type(getFunc) == 'function' then
return getFunc()
local getFunc = rawget(getters, k)
if type(getFunc) == 'function' then
-- log('E', '', ' getter hit: ' .. tostring(k) .. ' = ' .. tostring(res))
local setFunc = rawget(setters, k)
if type(setFunc) == 'function' then
rawset(origsetters, k, setFunc)
local setFunc = rawget(setters, k)
if type(setFunc) == 'function' then
rawset(origsetters, k, setFunc)
for k, v in pairs(mt) do
if type(k) == "string" then
rawset(workmt, k, rawget(workmt, k) or v)
for f, getter in pairs(v) do
if type(f) ~= 'number' then
rawset(plainGetters, f, getter)
for f, getter in pairs(v) do
if type(f) ~= 'number' then
rawset(plainGetters, f, getter)
@/lua/vehicle/jbeam/stage2.lua
local function checkNum(val, default)
return type(val) == 'number' and val or (default or 0)
end
beam.beamStrength = beam.beamStrength or vehicle.options.beamStrength or math.huge
if type(beam.beamStrength) == 'string' then
if tostring(beam.beamStrength) ~= tostring(tonumber(beam.beamStrength)) then
beam.beamDamp = beam.beamDamp or vehicle.options.beamDamp
if type(beam.beamDamp) == 'string' then
if tostring(beam.beamDamp) ~= tostring(tonumber(beam.beamDamp)) then
beam.beamDeform = beam.beamDeform or vehicle.options.beamDeform
if type(beam.beamDeform) == 'string' then
if tostring(beam.beamDeform) ~= tostring(tonumber(beam.beamDeform)) then
-- error detection
if type(beam.id1) == "string" or type(beam.id2) == "string" and tostring(beam.optional) == "true" then
log('W', "jbeam.pushToPhysics","- beam not committed as node was not found: " .. tostring(beam.id1) .. " -> " .. tostring(beam.id2) .. ' : ' .. dumps(beam))
-- error detection
if type(beam.id1) == "string" or type(beam.id2) == "string" and tostring(beam.optional) == "true" then
log('W', "jbeam.pushToPhysics","- beam not committed as node was not found: " .. tostring(beam.id1) .. " -> " .. tostring(beam.id2) .. ' : ' .. dumps(beam))
if type(beam.precompressionRange) == 'number' then
local bL = vec3(node1pos):distance(node2pos)
local beamPrecompression = beam.beamPrecompression
if type(beam.beamPrecompressionTime) == 'number' and beam.beamPrecompressionTime > 0 then
if beam.beamPrecompression == 1 then
local deformLimit = type(beam.deformLimit) == 'number' and beam.deformLimit or math.huge
local bid = obj:setBeam(beam.cid, beam.id1, beam.id2, beam.beamStrength, beam.beamSpring,
local bid = obj:setBeam(beam.cid, beam.id1, beam.id2, beam.beamStrength, beam.beamSpring,
beam.beamDamp, type(beam.dampCutoffHz) == 'number' and beam.dampCutoffHz or 0,
beam.beamDeform, deformLimit, type(beam.deformLimitExpansion) == 'number' and beam.deformLimitExpansion or deformLimit, type(beam.deformLimitStress) == 'number' and beam.deformLimitStress or math.huge,
beam.beamDamp, type(beam.dampCutoffHz) == 'number' and beam.dampCutoffHz or 0,
beam.beamDeform, deformLimit, type(beam.deformLimitExpansion) == 'number' and beam.deformLimitExpansion or deformLimit, type(beam.deformLimitStress) == 'number' and beam.deformLimitStress or math.huge,
beamPrecompression
beam.beamDamp, type(beam.dampCutoffHz) == 'number' and beam.dampCutoffHz or 0,
beam.beamDeform, deformLimit, type(beam.deformLimitExpansion) == 'number' and beam.deformLimitExpansion or deformLimit, type(beam.deformLimitStress) == 'number' and beam.deformLimitStress or math.huge,
beamPrecompression
beam.dampExpansion = beam.dampExpansion or beam.beamDamp
local longBound = type(beam.beamLongExtent) == 'number' and -max(0, beam.beamLongExtent) or max(0, beam.beamLongBound or math.huge)
obj:setBeamAnisotropic(bid, beam.springExpansion, beam.dampExpansion,
obj:setBeamAnisotropic(bid, beam.springExpansion, beam.dampExpansion,
type(beam.transitionZone) == 'number' and beam.transitionZone or 0, longBound
)
elseif(beam.beamType == BEAM_BOUNDED) then
local longBound = type(beam.longBoundRange) == 'number' and -max(0, beam.longBoundRange) or max(0, beam.beamLongBound or 1)
local shortBound = type(beam.shortBoundRange) == 'number' and -max(0, beam.shortBoundRange) or max(0, beam.beamShortBound or 1)
local longBound = type(beam.longBoundRange) == 'number' and -max(0, beam.longBoundRange) or max(0, beam.beamLongBound or 1)
local shortBound = type(beam.shortBoundRange) == 'number' and -max(0, beam.shortBoundRange) or max(0, beam.beamShortBound or 1)
beam.beamLimitSpring = beam.beamLimitSpring or 1
beam.beamDampVelocitySplit, checkNum(beam.beamDampVelocitySplitRebound, beam.beamDampVelocitySplit),
type(beam.boundZone) == 'number' and beam.boundZone or 1
)
elseif(beam.beamType == BEAM_SUPPORT) then
local longBound = type(beam.beamLongExtent) == 'number' and -max(0, beam.beamLongExtent) or max(0, beam.beamLongBound or 1)
beam.springExpansion = 0
obj:setBeamLbeam(bid, beam.id3,
type(beam.springExpansion) == 'number' and beam.springExpansion or beam.beamSpring,
type(beam.dampExpansion) == 'number' and beam.dampExpansion or beam.beamDamp
type(beam.springExpansion) == 'number' and beam.springExpansion or beam.beamSpring,
type(beam.dampExpansion) == 'number' and beam.dampExpansion or beam.beamDamp
)
local frictionCoef = type(node.frictionCoef) == 'number' and node.frictionCoef or 1
local slidingFrictionCoef = type(node.slidingFrictionCoef) == 'number' and node.slidingFrictionCoef or frictionCoef
local frictionCoef = type(node.frictionCoef) == 'number' and node.frictionCoef or 1
local slidingFrictionCoef = type(node.slidingFrictionCoef) == 'number' and node.slidingFrictionCoef or frictionCoef
local noLoadCoef = type(node.noLoadCoef) == 'number' and node.noLoadCoef or 1
local slidingFrictionCoef = type(node.slidingFrictionCoef) == 'number' and node.slidingFrictionCoef or frictionCoef
local noLoadCoef = type(node.noLoadCoef) == 'number' and node.noLoadCoef or 1
local fullLoadCoef = type(node.fullLoadCoef) == 'number' and node.fullLoadCoef or 0
local noLoadCoef = type(node.noLoadCoef) == 'number' and node.noLoadCoef or 1
local fullLoadCoef = type(node.fullLoadCoef) == 'number' and node.fullLoadCoef or 0
local loadSensitivitySlope = type(node.loadSensitivitySlope) == 'number' and node.loadSensitivitySlope or 0
local fullLoadCoef = type(node.fullLoadCoef) == 'number' and node.fullLoadCoef or 0
local loadSensitivitySlope = type(node.loadSensitivitySlope) == 'number' and node.loadSensitivitySlope or 0
local nodeWeight
if type(node.nodeWeight) == 'number' then
nodeWeight = node.nodeWeight
nodeMaterialTypeID = node.nodeMaterial
if type(nodeMaterialTypeID) ~= "number" then
--log('D', "jbeam.pushToPhysics","invalid node material id:"..tostring(nodeMaterialTypeID))
local bType = beam.beamType or NORMALTYPE
if type(bType) == "string" then bType = NORMALTYPE end
local torqueArm
if type(wheel.torqueArm) == 'number' then
torqueArm = wheel.torqueArm
else
if type(wheel.torqueArm) ~= 'nil' then
log('W', "jbeam.pushToPhysics","*** wheel: "..wheel.name..' could not bind torqueArm for wheel')
local nodeCouple = wheel.nodeCouple or wheel.nodeCoupling
if type(nodeCouple) == 'string' then
log('W', "jbeam.pushToPhysics","*** wheel: "..wheel.name..' nodeCouple needs a ":" at the end')
local torqueCouple = wheel.torqueCouple or wheel.torqueCoupling
if type(torqueCouple) == 'string' then
log('W', "jbeam.pushToPhysics","*** wheel: "..wheel.name..' torqueCouple needs a ":" at the end')
checkNum(wheel.heatCoefStrain), checkNum(wheel.smokingTemp, 1e18), checkNum(wheel.meltingTemp, 1e19),
type(wheel.heatAffectsPressure) == 'boolean' and wheel.heatAffectsPressure or false
)
if type(hydro.extentFactor) == 'number' then
hydro.factor = hydro.extentFactor
if type(hydro.factor) == 'number' then
hydro.inLimit = -math.abs(hydro.factor)
local id1, id2, id3, id4 = tb.id1, tb.id2, tb.id3, tb.id4
if type(id1) ~= 'number' then
id1, spring, spring2, damp, damp2 = 0, 0, 0, 0, 0
end
if type(id2) ~= 'number' then
id2, spring, spring2, damp, damp2 = 0, 0, 0, 0, 0
end
if type(id3) ~= 'number' then
id3, spring, spring2, damp, damp2 = 0, 0, 0, 0, 0
end
if type(id4) ~= 'number' then
id4, spring, spring2, damp, damp2 = 0, 0, 0, 0, 0
local precompressionAngle = tb.precompressionAngle
if type(tb.precompressionTime) == 'number' and tb.precompressionTime > 0 then
if precompressionAngle == 0 then
if triangle.breakGroup == '' then triangle.breakGroup = nil end
if triangle.triangleType ~= nil and type(triangle.triangleType) == 'string' then
triangle.triangleType = triTypeMap[triangle.triangleType]
triangle.cid = obj:setTriangle(-1, triangle.id1, triangle.id2, triangle.id3, dragCoef * 0.01, liftCoef * 0.01,
(triangle.skinDragCoef or 0) * 0.01, type(triangle.stallAngle) == 'number' and triangle.stallAngle or 0.58,
pressure, pressureGroup, externalCollision, triangle.triangleType, triangle.groundModel or "asphalt")
local function pushToPhysics(vehicle)
if type(vehicle) ~= 'table' then return end
--log('D', "jbeam.pushToPhysics"," ** pushing vehicle to physics")
@/gameplay/missionTypes/garageToGarage/constructor.lua
local filterData = missionTypeData.vehicleFilters
if filterData and type(filterData) == "table" then
local hasFilters = false
if source then
if type(source) == "string" then
isModCar = source ~= "BeamNG - Official"
isModCar = source ~= "BeamNG - Official"
elseif type(source) == "table" then
isModCar = not source["BeamNG - Official"]
local filterSettings = nil
if filterData and type(filterData) == "table" then
-- Use filter settings if there are any filters OR if the flags are explicitly set
@/lua/ge/extensions/editor/dynamicDecals/notification.lua
im.SameLine()
local msgtype = type(notification.msg)
if msgtype == 'string' then
@/lua/ge/extensions/ui/vehicleSelector/tileClustering.lua
local years = config.Years or config.years or math.huge
if type(years) == "table" then
years = years.min
local value = config.Value or config.value or 0
if type(value) == "table" then
value = value.min
@/lua/common/libs/xlsxlib/tests/tests.lua
for k, v in pairs(t) do
if type(k) == "string" and tonumber(k) then
normalized[tonumber(k)] = v
if t1 == t2 then return true end
if type(t1) ~= "table" or type(t2) ~= "table" then return false end
if t1 == t2 then return true end
if type(t1) ~= "table" or type(t2) ~= "table" then return false end
for k, v in pairs(t1) do
if type(v) == "table" and type(t2[k]) == "table" then
if not tablesEqual(v, t2[k]) then return false end
for k, v in pairs(t1) do
if type(v) == "table" and type(t2[k]) == "table" then
if not tablesEqual(v, t2[k]) then return false end
@/lua/common/luaProfiler.lua
function C:finish(compute, dt)
local detectPeaks = type(dt) == "number"
dt = detectPeaks and dt or 0
@/lua/vehicle/ve_utils.lua
if type(header) ~= "table" then
log("W", "tableFromHeaderTable", "*** Invalid table header: " .. dumpsz(entry, 2) .. " - " .. debug.tracesimple())
if type(rowValue) ~= "table" then
log("W", "tableFromHeaderTable", "*** Invalid table row: " .. dumps(rowValue))
-- allow last type to be the options always
if #rowValue > headerSize + 1 then -- and type(rowValue[#rowValue]) ~= "table" then
log("W", "tableFromHeaderTable", "*** Invalid table header, must be as long as all table cells (plus one additional options column):")
-- check if inline options are provided, merge them then
if rvcc >= headerSize and type(rv) == "table" and tableIsDict(rv) and #rowValue > headerSize then
tableMerge(newRow, rv)
local function toJSONString(d)
if type(d) == "string" then
return '"' .. d .. '"'
return '"' .. d .. '"'
elseif type(d) == "number" then
return string.format("%g", d)
if type(data) == "table" and type(data["partPath"]) == "string" and data["partPath"] ~= "" then
f:write("\n" .. indent .. "/*" .. string.rep("*", 50) .. "\n")
if type(data) == "table" and type(data["partPath"]) == "string" and data["partPath"] ~= "" then
f:write("\n" .. indent .. "/*" .. string.rep("*", 50) .. "\n")
end
if type(data) == "table" then
if tableIsDict(data) then
for k, v in pairs(data) do
if type(v) == "table" then
--if nl then f:write("\n" end
local v = data[i]
if type(v) == "table" then
saveCompiledJBeamRecursive(f, v, level + 1)
@/lua/ge/extensions/c2/panelPlugins/tileManager.lua
local s = {1, 1, 1}
if type(scale) == 'number' then
s = {scale, scale, scale}
s = {scale, scale, scale}
elseif type(scale) == 'cdata' or type(scale) == 'table' then
s = { scale.x, scale.y, scale.z }
s = {scale, scale, scale}
elseif type(scale) == 'cdata' or type(scale) == 'table' then
s = { scale.x, scale.y, scale.z }
local sx, sy, sz = 1, 1, 1
if type(scale) == 'table' and scale[1] then
sx, sy, sz = scale[1], scale[2], scale[3]
sx, sy, sz = scale[1], scale[2], scale[3]
elseif type(scale) == 'number' then
sx, sy, sz = scale, scale, scale
sx, sy, sz = scale, scale, scale
elseif type(scale) == 'cdata' then
sx, sy, sz = scale.x, scale.y, scale.z
@/lua/ge/extensions/editor/gen/lib/ui.lua
if not shift then shift = im.ImVec2(0,0) end
if cbg and type(cbg) == 'table' then
cbg = im.ImVec4(cbg[1], cbg[2], cbg[3], cbg[4])
if not scale then scale = vec3(1,1) end
if type(kv) ~= 'table' then
kv = {kv}
@/lua/ge/extensions/scenario/quickRace.lua
for _, e in ipairs(config.lapConfig) do
if type(e) == 'string' then
table.insert(lc, e)
@/lua/ge/extensions/util/trackBuilder/splineTrack.lua
local function deepcopy(orig)
local orig_type = type(orig)
local copy
ignoreCollision = ignoreCol
if type(originalFilename) == "table" then
read = originalFilename
if not silent then
if type(originalFilename) == "table" then
guihooks.trigger('Message', {ttl = 10, msg = 'Succesfully loaded track', category = "fill", icon = "check_circle"})
@/lua/ge/extensions/editor/api/genericInspector.lua
local function tableIsArray(tbl)
if type(tbl) ~= "table" then return false end
local count = 0
for k, v in pairs(tbl) do
if type(k) ~= "number" then return false else count = count + 1 end
end
for i = 1, count do
if not tbl[i] and type(tbl[i]) ~= "nil" then return false end
end
@/inspector/Models/ScopeChainNode.js
get type() { return this._type; }
get objects() { return this._objects; }
@/lua/ge/extensions/core/cameraModes/onboard.lua
if type(self.offset) == 'table' then
nodePos = nodePos + dir * (self.offset.x or 0) - camLeft * (self.offset.y or 0) + camUp * (self.offset.z or 0)
@/lua/common/libs/timerwheel/timerwheel.lua
opts = opts or EMPTY
assert(type(opts) == "table", "expected options to be a table")
assert(type(precision) == "number" and precision > 0,
"expected 'precision' to be number > 0")
"expected 'precision' to be number > 0")
assert(type(ringsize) == "number" and ringsize > 0 and math_floor(ringsize) == ringsize,
"expected 'ringsize' to be an integer number > 0")
"expected 'ringsize' to be an integer number > 0")
assert(type(now) == "function",
"expected 'now' to be a function, got: " .. type(now))
assert(type(now) == "function",
"expected 'now' to be a function, got: " .. type(now))
assert(type(err_handler) == "function",
"expected 'now' to be a function, got: " .. type(now))
assert(type(err_handler) == "function",
"expected 'err_handler' to be a function, got: " .. type(err_handler))
assert(type(err_handler) == "function",
"expected 'err_handler' to be a function, got: " .. type(err_handler))
@/lua/ge/extensions/flowgraph/nodes/ui/customUiLayout.lua
for key, layout in pairs(layouts) do
if type(layout) == "table" and #layout > 0 then
table.insert(sorted, key)
@/lua/ge/extensions/gameplay/crawl/utils.lua
for _, value in pairs(dF or {}) do
if type(value) == "string" and value == dynamicName then
table.insert(dynamicObjects, id)
@/lua/common/jbeam/sections/events.lua
end
if type(ab.label) == 'string' then
abo.label = ab.label
local typeStr = ab.type or 'box'
if typeStr == 'box' and type(ab.size) == 'table' then
ab.size = vec3(ab.size)
abo:setBoxSize(ab.size)
elseif typeStr == 'sphere' and type(ab.size) == 'number' then
abo:setSphereSize(ab.size)
@/lua/common/libs/luasocket/socket/mime.lua
return function(name, opt1, opt2)
if base.type(name) ~= "string" then
name, opt1, opt2 = "default", name, opt1
@/lua/ge/extensions/flowgraph/basenode.lua
--print(self.id .. ' ' .. self.name .. ' double-clicked')
if self.doubleClicked and type(self.doubleClicked) == 'function' then
self:doubleClicked()
local t = forceType or pin.type
if type(t) == 'table' then
t = pin.defaultHardCodeType or t[1]
-- cdata
if type(v) == 'cdata' then
-- Cdata
if type(data) == 'cdata' then
-- lua type
@/lua/vehicle/powertrain/rangeBox.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/common/settings.lua
-- we have C++ type information
if type(CppSettings[k]) ~= type(value) then
log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
-- we have C++ type information
if type(CppSettings[k]) ~= type(value) then
log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
if type(CppSettings[k]) ~= type(value) then
log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
values[k] = nil
if type(CppSettings[k]) ~= type(value) then
log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
values[k] = nil
@/lua/ge/extensions/core/settings/graphic.lua
local v = tonumber( TorqueScriptLua.getVar('$video::vsync') )
return v == true or (type(v)=="number" and v > 0)
end,
set = function ( value )
local boolValue = value == true or (type(value)=="number" and value > 0)
TorqueScriptLua.setVar( '$video::vsync', boolValue )
-- log('I','graphic',' setting GraphicOverallQuality = '..tostring(value))
if type(value) == 'string' and tonumber(value) then
value = tonumber(value)
end
if type(value) == 'number' then
local upgrade_old_id_to_name = {'Custom', 'Lowest', 'Low', 'Normal', 'High', 'Ultra'}
set = function ( value )
if type(value) == 'string' and tonumber(value) then
value = tonumber(value)
end
if type(value) == 'number' then
local upgrade_old_id_to_name = {'Lowest', 'Low', 'Normal', 'High', 'Ultra'}
set = function ( value )
if type(value) == 'string' and tonumber(value) then
value = tonumber(value)
end
if type(value) == 'number' then
local upgrade_old_id_to_name = {'Lowest', 'Low', 'Normal', 'High'}
set = function ( value )
if type(value) == 'string' and tonumber(value) then
value = tonumber(value)
end
if type(value) == 'number' then
local upgrade_old_id_to_name = {'Lowest', 'Low', 'High', 'Ultra'}
set = function ( value )
if type(value) == 'string' and tonumber(value) then
value = tonumber(value)
end
if type(value) == 'number' then
local upgrade_old_id_to_name = {'Lowest', 'Low', 'Normal', 'High'}
set = function ( value )
if type(value) == 'string' and tonumber(value) then
value = tonumber(value)
end
if type(value) == 'number' then
local upgrade_old_id_to_name = {'Low', 'High'}
for k,v in pairs(data) do
if graphicsOptions[k] and type(graphicsOptions[k].init) == 'function' then
graphicsOptions[k].init(v)
if newState.WindowPlacement and newState.WindowPlacement ~= M.current_windowPlacement then
if graphicsOptions.WindowPlacement and type(graphicsOptions.WindowPlacement.set) == 'function' then
graphicsOptions.WindowPlacement.set(newState.WindowPlacement)
-- dump(tostring(M.selected_displayDriver) .. ' is now '.. newState.GraphicDisplayDriver)
if graphicsOptions.GraphicDisplayDriver and type(graphicsOptions.GraphicDisplayDriver.set) == 'function' then
graphicsOptions.GraphicDisplayDriver.set(newState.GraphicDisplayDriver)
-- dump(tostring(M.selected_displayMode) .. ' is now '.. newState.GraphicDisplayModes)
if graphicsOptions.GraphicDisplayModes and type(graphicsOptions.GraphicDisplayModes.set) == 'function' then
graphicsOptions.GraphicDisplayModes.set(newState.GraphicDisplayModes)
-- dump(tostring(M.selected_resolution) .. ' is now '.. newState.GraphicDisplayResolutions)
if graphicsOptions.GraphicDisplayResolutions and type(graphicsOptions.GraphicDisplayResolutions.set) == 'function' then
graphicsOptions.GraphicDisplayResolutions.set(newState.GraphicDisplayResolutions)
-- dump(tostring(M.selected_refreshRate) .. ' is now '.. newState.GraphicDisplayRefreshRates)
if graphicsOptions.GraphicDisplayRefreshRates and type(graphicsOptions.GraphicDisplayRefreshRates.set) == 'function' then
graphicsOptions.GraphicDisplayRefreshRates.set(newState.GraphicDisplayRefreshRates)
@/lua/ge/extensions/gameplay/drift/stuntZones.lua
if stuntZone.scl then
if type(stuntZone.scl) == "number" then
nearDist = stuntZone.scl + 6
@/inspector/Models/ProfileNode.js
get type()
{
@/lua/ge/extensions/flowgraph/nodes/debug/display.lua
if type(self._lastVal) == 'table' then
if im.Button("Dump##"..self.id) then
@/lua/ge/extensions/editor/raceEditor/timeTrials.lua
local files = {}
if type(f) == 'string' then
files = {f, f..'.prefab', f..'.prefab.json',f..'.json',
@/lua/ge/extensions/gameplay/rally/util.lua
-- for k, v in pairs(obj) do
-- -- if type(v) == "function" then
-- print(k)
@/lua/ge/extensions/core/input/actionFilter.lua
local function addToFilter(filter, actionName, filtered)
if type(actionGroups[actionName]) == 'table' then
for i, a in ipairs(actionGroups[actionName]) do
@/lua/common/libs/resty/template/html.lua
for k, v in pairs(attr) do
if type(k) == "number" then
a[#a + 1] = escape(v)
end
if type(content) == "string" then
r[#r + 1] = ">"
return function(attr)
if type(attr) == "table" then
return function(content)
@/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/flowgraph/nodes/ui/rtMessage.lua
if self.pinIn.flow.value then
if type(self.pinIn.message.value) == 'table' then
-- this app wants the message in a different format :/
@/lua/vehicle/controller/advancedCouplerControl.lua
if type(cnp.cid2) == "table" then
couplerNodePairData.availableCid2 = {}
@/lua/ge/extensions/core/input/bindings.lua
local function deepcompare(t1,t2)
local ty1 = type(t1)
local ty2 = type(t2)
local ty1 = type(t1)
local ty2 = type(t2)
if ty1 ~= ty2 then return false end
for _, info in ipairs(guids) do
if not info.skipMigration and type(info.id) == "string" then
table.insert(candidatePaths, dir.."/"..string.lower(info.id)..".diff")
@/lua/ge/extensions/ui/vehicleSelector/tileSorting.lua
local bValue = b.Value or b.value or 0
if type(aValue) == 'table' then
aValue = aValue.min
end
if type(bValue) == 'table' then
bValue = bValue.min
local bYears = b.Years or b.years or math.huge
if type(aYears) == 'table' then
aYears = aYears.min
end
if type(bYears) == 'table' then
bYears = bYears.min
@/lua/common/libs/copas/copas/http.lua
_M.request = socket.protect(function(reqt, body)
if base.type(reqt) == "string" then
reqt = _M.parseRequest(reqt, body)
@/lua/vehicle/controller/esc.lua
for name, config in pairs(escConfigs.configurations) do
if type(config) == "table" and config.escConfigurationEnabled then
table.insert(tmpConfigs, sanitizeConfiguration(shallowcopy(config), name)) --we need to create copies of all our configurations as we are going to use them for saving a few values as well and we want a fresh copy every time we reset the vehicle
for _, config in pairs(escConfigurations) do
if type(config) == "table" and config.escConfigurationEnabled and config.characteristicSpeed <= 0 then --calculate char. speed if no override is provided
config.characteristicSpeed = calculateCharacteristicSpeed(config)
local blacklistedEngines = {}
if escConfigs.blacklistedEngines and type(escConfigs.blacklistedEngines) == "table" then
for _, v in pairs(escConfigs.blacklistedEngines) do
@/lua/common/libs/luamqtt/mqtt/init.lua
loop:add(cl)
if type(cl) ~= "function" then
cl:start_connecting()
@/lua/ge/extensions/editor/materialEditor.lua
local function _openPickMapToFromObjectPopup()
if pickingFromObjectMaterials and type(pickingFromObjectMaterials) == "table" and #pickingFromObjectMaterials > 0 then
table.sort(pickingFromObjectMaterials)
setPropertyWithUndo(property, layer, editor.getTempCharPtr())
if onEditEndedCallback and type(onEditEndedCallback) == "function" then
onEditEndedCallback()
@/lua/ge/extensions/scenario/quickRaceLoader.lua
if type(levelInfo.levelInfo.previews) == 'table' and #levelInfo.levelInfo.previews > 0 then
-- add prefix
@/inspector/Views/ResourcesTabContentView.js
get type()
{
@/lua/vehicle/backwardsCompatibility.lua
for _, v in ipairs(oldEngine.gears) do
if type(v) == "number" then
table.insert(gearbox.gearRatios, v)
@/inspector/Models/CSSStyleDeclaration.js
get type()
{
@/lua/ge/extensions/core/vehicleTriggers.lua
im.TableNextRow()
if vData and vData.vdata and type(vData.vdata.triggers) == 'table' then
for _, trg in pairs(vData.vdata.triggers or {}) do
im.TableHeadersRow()
if vData and vData.vdata and type(vData.vdata.events) == 'table' then
for _, evt in pairs(vData.vdata.events or {}) do
if vData and vData.vdata and type(vData.vdata.triggerEventLinksDict) == 'table' then
for triggerId, lnkDict in pairs(vData.vdata.triggerEventLinksDict or {}) do
local vData = extensions.core_vehicle_manager.getVehicleData(hit.v)
if vData and vData.vdata and type(vData.vdata.triggers) == 'table' then
local trigger = vData.vdata.triggers[hit.t]
if not vdata.triggerEventLinksDict then return end
if type(vdata.triggerEventLinksDict[triggerId]) ~= 'table' then return end
if type(vdata.triggerEventLinksDict[triggerId][actionStr]) ~= 'table' then return end
if type(vdata.triggerEventLinksDict[triggerId]) ~= 'table' then return end
if type(vdata.triggerEventLinksDict[triggerId][actionStr]) ~= 'table' then return end
local vData = extensions.core_vehicle_manager.getVehicleData(currentTriggerHit.v)
if vData and vData.vdata and type(vData.vdata.triggers) == 'table' then
local trigger = vData.vdata.triggers[currentTriggerHit.t]
@/lua/vehicle/hydros.lua
if ffbParams.softlockForce~= nil then softlockForceCoef = clamp(ffbParams.softlockForce, 0, 1) end
if type(input.lowspeedCoefFFB) == "boolean" then
log("I", "", string.format("This vehicle's steering hydro has specified a custom lowspeedCoefFFB setting. Overriding the binding setting lowspeedCoef=%s with the hydro setting lowspeedCoef=%s", dumps(ffbParams.lowspeedCoef), dumps(input.lowspeedCoefFFB)))
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/vehicleStoppedNearPos.lua
if self.targetPos == nil then
if type(self.pinIn.pos.value) == "table" and not self.pinIn.pos.value.x then
self.targetPos = vec3(self.pinIn.pos.value)
@/inspector/Views/SearchTabContentView.js
get type()
{
@/lua/ge/extensions/freeroam/specialTriggers.lua
-- table of linked scenetree objects or SimGroups
if type(data.objects) == 'table' then
triggers[key].objects = {}
@/inspector/Views/NewTabContentView.js
get type()
{
@/inspector/Models/ObjectPreview.js
get type() { return this._type; }
get subtype() { return this._subtype; }
@/lua/common/libs/lua-websockets/websocket/client_ev.lua
local ws_protocols_tbl = {''}
if type(ws_protocol) == 'string' then
ws_protocols_tbl = {ws_protocol}
ws_protocols_tbl = {ws_protocol}
elseif type(ws_protocol) == 'table' then
ws_protocols_tbl = ws_protocol
@/lua/ge/extensions/editor/dynamicDecals/docs.lua
M.register = function(data)
if type(data.section) ~= 'table' then
editor.logWarn(logTag .. " - register(): section must be of type 'table'")
if type(section) == "string" then
im.ImGuiTextFilter_Clear(filter)
selectSectionInChildren(docsSections, section)
elseif type(section) == "table" then
if #section == 0 then return end
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veView.lua
local viewsSerialized = editor.getPreference("vehicleEditor.veView.sceneViews")
if type(viewsSerialized) == 'table' then
for id, data in ipairs(viewsSerialized) do
@/inspector/Views/SourcesTabContentView.js
get type()
{
@/lua/common/jbeam/scaling.lua
for keyEntry, entry in pairs(vehicle) do
if type(entry) == "table" and tableIsDict(entry) and not jbeamUtils.ignoreSections[keyEntry] then
stack[1] = entry
for key, v in pairs(data) do
local typev = type(v)
if typev == 'number' then
if typev == 'number' then
if type(key) == 'string' and str_byte(key,1)==115 and str_byte(key,2)==99 and str_byte(key,3)==97 and str_byte(key,4)==108 and
str_byte(key,5)==101 and str_byte(key,6)~=nil then --scale
local dataval = data[keytoscale]
if type(dataval) == "number" then
data[keytoscale] = dataval * v
@/inspector/Models/CallingContextTree.js
get type() { return this._type; }
get totalNumberOfSamples() { return this._totalNumberOfSamples; }
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/endScreenResults.lua
local text = self.pinIn.text.value
if (type(text) == 'table' and text.txt == '') or text == '' then
text = nil
@/lua/common/csvlib.lua
local v = select(i, ...)
local vtype = type(v)
if vtype == 'number' then
@/lua/common/json-ast.lua
local keyVal = _convertToLuaNative(ctx, childNodeIdx, addAstId)
if type(keyVal) == 'string' then
storedKey = keyVal
for _, partRoot in pairs(fileRoot) do
if type(partRoot) == 'table' then
jbeamTableSchema.process(partRoot, true)
local function _cleanupData(node)
if type(node) == 'table' then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
if type(node) == 'table' then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
node.pos = vec3(node.posX, node.posY, node.posZ)
if type(node) == 'table' then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
node.pos = vec3(node.posX, node.posY, node.posZ)
if type(node) == 'table' then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
node.pos = vec3(node.posX, node.posY, node.posZ)
@/lua/ge/extensions/core/sounds.lua
if vehicle then
if type(nodeIdArray) ~= 'table' then
nodeIdArray = {nodeIdArray}
if vehicle then
if type(nodeIdPairArray) ~= 'table' then
nodeIdPairArray = {{nodeIdPairArray, nodeIdPairArray}}
@/lua/ge/extensions/ui/policeInfo.lua
for k, v in pairs(lastPursuitData) do
if type(v) == 'number' then
lastPursuitData[k] = 0
for _, v in ipairs(pd.info) do
if type(v) == 'table' then
v.txt = pursuit[v.key] or ''
v.txt = pursuit[v.key] or ''
if type(v.txt) == 'number' and v.key == 'duration' then
local minutes = math.floor(v.txt / 60)
@/lua/common/libs/LuaIRC/init.lua
if type(_host) == "table" then
host = _host.host
local params
if type(secure) == "table" then
params = secure
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
for pos,val in pairs(t) do
for pos,val in pairs(t) do
if (type(val)=="table") then
print(indent.."["..pos.."] => "..tostring(t).." {")
print(indent..string.rep(" ",string.len(pos)+6).."}")
elseif (type(val)=="string") then
print(indent.."["..pos..'] => "'..val..'"')
end
if (type(t)=="table") then
print(tostring(t).." {")
@/lua/common/libs/luamqtt/mqtt/protocol.lua
function protocol.parse_string(read_func)
assert(type(read_func) == "function", "expecting read_func to be a function")
local len, err = read_func(2)
local function parse_uint8(read_func)
assert(type(read_func) == "function", "expecting read_func to be a function")
local value, err = read_func(1)
local function parse_uint16(read_func)
assert(type(read_func) == "function", "expecting read_func to be a function")
local value, err = read_func(2)
function protocol.parse_uint32(read_func)
assert(type(read_func) == "function", "expecting read_func to be a function")
local value, err = read_func(4)
local function parse_var_length(read_func)
assert(type(read_func) == "function", "expecting read_func to be a function")
local mult = 1
end
assert(type(curr) == "number", "expecting curr to be a number")
assert(curr >= 1, "expecting curr to be >= 1")
function protocol.packet_id_required(args)
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.type) == "number", "expecting .type to be a number")
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.type) == "number", "expecting .type to be a number")
local ptype = args.type
local function value_tostring(value)
local t = type(value)
if t == "string" then
for k, v in pairs(value) do
if type(k) == "number" then
res[#res + 1] = value_tostring(v)
function protocol.start_parse_packet(read_func)
assert(type(read_func) == "function", "expecting read_func to be a function")
local byte1, err, len, data
@/lua/common/libs/luasocket/socket/smtp.lua
self:mail(mailt.from)
if base.type(mailt.rcpt) == "table" then
for i,v in base.ipairs(mailt.rcpt) do
function send_message(mesgt)
if base.type(mesgt.body) == "table" then send_multipart(mesgt)
elseif base.type(mesgt.body) == "function" then send_source(mesgt)
if base.type(mesgt.body) == "table" then send_multipart(mesgt)
elseif base.type(mesgt.body) == "function" then send_source(mesgt)
else send_string(mesgt) end
@/lua/ge/extensions/editor/api/history.lua
if t1 == t2 then return true end
if type(t1) ~= "table" or type(t2) ~= "table" then return false end
if t1 == t2 then return true end
if type(t1) ~= "table" or type(t2) ~= "table" then return false end
@/inspector/Views/LayersTabContentView.js
get type() { return WI.LayersTabContentView.Type; }
get supportsSplitContentBrowser() { return false; }
@/lua/vehicle/controller/vehicleController/shiftLogic/electricMotor.lua
local motorNames = jbeamData.motorNames or {"mainMotor"}
motorNames = type(motorNames) ~= "table" and {motorNames} or motorNames
for _, v in ipairs(motorNames) do
@/lua/ge/extensions/flowgraph/pin.lua
local function formatValueForDisplay(val, hardType)
local type = hardType or type(val)
if type == 'number' then
function C:getTableType()
if self.type == "table" or (type(self.type) == "table" and tableContains(self.type, "table")) then
return self.tableType or "generic"
end
if type(self.type) == 'table' then
typeTxt = typeTxt .. ' types: ' .. dumps(self.type)
if self.type == "table" or (type(self.type) == 'table' and tableContains(self.type,'table')) then
im.TextUnformatted("Table type: "..self:getTableType())
@/lua/ge/extensions/gameplay/rally/rallyManager.lua
-- log('D', logTag, string.format('enqueueRandomSystemPacenote: %s - raw audioLen value: %s (type: %s)', basename, tostring(metadataVal.audioLen), type(metadataVal.audioLen)))
if not audioLen then
log('E', logTag, string.format('enqueueRandomSystemPacenote: invalid audioLen for %s: %s (type: %s)', basename, tostring(metadataVal.audioLen), type(metadataVal.audioLen)))
return
@/lua/vehicle/controller/pneumatics/actuators.lua
-- if electrics value has changed enough since the last update, we take that instead of the last "requested" state
if type(electricsValveState) == "number" and abs(electricsValveState - g.lastElectricsValue) > 1e-20 then
g.valveState = electricsValveState
local maxSupplyPressure = jbeamData.maxSupplyPressure or math.huge
if type(jbeamData.maxSupplyPressurePSI) == "number" then
maxSupplyPressure = jbeamData.maxSupplyPressurePSI * psiToPascal + 101325
local beamMaxSupplyPressure = pressureData.maxSupplyPressure or maxSupplyPressure
if type(pressureData.maxSupplyPressurePSI) == "number" then
beamMaxSupplyPressure = pressureData.maxSupplyPressurePSI * psiToPascal + 101325
@/lua/ge/extensions/career/modules/vehicleShopping.lua
if vehicleWatchlist[vehicleInfo.shopId] then
if type(vehicleWatchlist[vehicleInfo.shopId]) ~= "number" then
vehicleWatchlist[vehicleInfo.shopId] = currentTime + timeToRemoveSoldVehicle -- time to remove the vehicle from the watchlist
@/lua/ge/extensions/freeroam/freeroam.lua
local levelPath = level
if type(level) == 'table' then
setSpawnpoint.setDefaultSP(startPointName, level.levelName)
local time = M.spawningOptionsHelper.timeOfDay
if type(time) == 'string' then
-- Get time of day options for the current level
end
if type(time) == 'number' then
log('I', logTag, 'Setting time of day to: ' .. tostring(time))
@/lua/common/tech/techUtils.lua
local function tableToVec3OrQuat(tbl)
if type(tbl) == 'table' then
if type(tbl.x) == 'number' and type(tbl.y) == 'number' and type(tbl.z) == 'number' then
if type(tbl) == 'table' then
if type(tbl.x) == 'number' and type(tbl.y) == 'number' and type(tbl.z) == 'number' then
if tbl.w == nil then return vec3(tbl.x, tbl.y, tbl.z) end
if type(tbl) == 'table' then
if type(tbl.x) == 'number' and type(tbl.y) == 'number' and type(tbl.z) == 'number' then
if tbl.w == nil then return vec3(tbl.x, tbl.y, tbl.z) end
if type(tbl) == 'table' then
if type(tbl.x) == 'number' and type(tbl.y) == 'number' and type(tbl.z) == 'number' then
if tbl.w == nil then return vec3(tbl.x, tbl.y, tbl.z) end
if tbl.w == nil then return vec3(tbl.x, tbl.y, tbl.z) end
if type(tbl.w) == 'number' then return quat(tbl.x, tbl.y, tbl.z, tbl.w) end
end
local function tableToVec3Recursive(tbl)
if type(tbl) ~= 'table' then return tbl end
for k, v in pairs(tbl) do
tbl[k] = newV
if type(newV) == "table" then
tableToVec3Recursive(newV)
local function migrateOldKeysRecursive(tbl)
if type(tbl) ~= 'table' then return tbl end
for k, v in pairs(tbl) do
end
if type(v) == "table" then
migrateOldKeysRecursive(v)
@/lua/ge/extensions/gameplay/rally/tools/loopToolbox.lua
-- local stallPos = manager.fgVariables and manager.fgVariables.serviceStallPos
-- if stallPos and type(stallPos) == "table" then
-- if im.Button("Focus on Service Stall") then
-- local outTriggerPos = manager.fgVariables and manager.fgVariables.serviceOutTriggerPos
-- if outTriggerPos and type(outTriggerPos) == "table" then
-- if im.Button("Focus on Service Out Trigger") then
@/lua/ge/extensions/editor/util/editorElementHelper.lua
if valueOptions.oneDimScale == nil and valueOptions.defaultScl then valueOptions.oneDimScale = type(valueOptions.defaultScl)=='number' end
elem.oneDimScale = valueOptions.oneDimScale or false
-- filepath can be a table, allowing for one of the files to be required
if type(filepathsInfolder) == 'string' then
filepathsInfolder = {filepathsInfolder}
element.displayOptions = element.displayOptions or {}
if element.displayOptions.associatedStars and type(element.displayOptions.associatedStars) == 'string' then
local key = element.displayOptions.associatedStars
-- Check if old vehicleFilters format exists (array of vehicle configs, not filter settings object)
if ctd[e.fieldName] and type(ctd[e.fieldName]) == "table" and #ctd[e.fieldName] > 0 then
-- Check if it's the old format (array with model/config) or new format (object with baseFilter)
-- This is correct for vehicleFilter/zoneSelector which save strings, not tables
if ctd[val.fieldName] ~= nil and val.value ~= nil and (type(ctd[val.fieldName]) ~= type(val.value)) then
table.insert(issues, {label = 'Mismatched '.. self.typeDataFieldName .. ' Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(ctd[val.fieldName]), type(val.value)), data=val, severity='error', fixable=true})
-- This is correct for vehicleFilter/zoneSelector which save strings, not tables
if ctd[val.fieldName] ~= nil and val.value ~= nil and (type(ctd[val.fieldName]) ~= type(val.value)) then
table.insert(issues, {label = 'Mismatched '.. self.typeDataFieldName .. ' Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(ctd[val.fieldName]), type(val.value)), data=val, severity='error', fixable=true})
if ctd[val.fieldName] ~= nil and val.value ~= nil and (type(ctd[val.fieldName]) ~= type(val.value)) then
table.insert(issues, {label = 'Mismatched '.. self.typeDataFieldName .. ' Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(ctd[val.fieldName]), type(val.value)), data=val, severity='error', fixable=true})
end
if ctd[val.fieldName] ~= nil and val.value ~= nil and (type(ctd[val.fieldName]) ~= type(val.value)) then
table.insert(issues, {label = 'Mismatched '.. self.typeDataFieldName .. ' Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(ctd[val.fieldName]), type(val.value)), data=val, severity='error', fixable=true})
end
-- Handle displayOptions as either a table or a string (tooltip)
local displayOpts = type(e.displayOptions) == 'table' and e.displayOptions or {}
editEnded[0] = im.InputFloat('##'..e.fieldName, e.ptr, displayOpts.stepSmall or 1, displayOpts.stepLarge or 5, displayOpts.format or nil, im.InputTextFlags_EnterReturnsTrue)
-- Show tooltip if displayOptions is a string or has a tooltip property
if type(e.displayOptions) == 'string' then
im.tooltip(e.displayOptions)
end
if self.activity and self.activity.layers and type(self.activity.layers) == "table" then
for _, layer in ipairs(self.activity.layers) do
@/lua/ge/extensions/scenario/driftGoal.lua
if instance.id == 'drift' then
if instance.value.minDrift and type(instance.value.minDrift)~="number" then
log('E', 'In '..tostring(scenario.name), ' minDrift must contain number value ')
end
if instance.value.maxDrift and type(instance.value.maxDrift)~= "number" then
log('E', 'In '..tostring(scenario.name), ' maxDrift must contain number value ')
@/lua/ge/extensions/gameplay/markerInteraction.lua
local val
if type(mAttKey) == 'string' then
val = att.valuesByKey[m.additionalAttributes[attKey]]
val = att.valuesByKey[m.additionalAttributes[attKey]]
elseif type(mAttKey) == 'table' then
val = m.additionalAttributes[attKey]
if gameplay_missions_missionManager.getForegroundMissionId() == nil and core_groundMarkers.currentlyHasTarget() then
if freeroam_bigMapMode and not freeroam_bigMapMode.bigMapActive() and type(core_groundMarkers.endWP[1]) == "cdata" then -- is vec3
local nextFixedWP = core_groundMarkers.routePlanner:getNextFixedWP()
@/lua/common/jit/v.lua
local function fmterr(err, info)
if type(err) == "number" then
if type(info) == "function" then info = fmtfunc(info) end
if type(err) == "number" then
if type(info) == "function" then info = fmtfunc(info) end
local fmt = vmdef.traceerr[err]
@/lua/common/libs/lunajson/lunajson/sax.lua
-- initialize
if type(src) == 'string' then
json = src
@/lua/vehicle/extensions/tech/impactgen/damageEvaluation.lua
for k, v in pairs(v.data.nodes[id]) do
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Node prop: ' .. tostring(k) .. ' of type: ' .. type(v))
for k, v in pairs(v.data.nodes[id]) do
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Node prop: ' .. tostring(k) .. ' of type: ' .. type(v))
for k, v in pairs(v.data.nodes[id]) do
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Node prop: ' .. tostring(k) .. ' of type: ' .. type(v))
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Node prop: ' .. tostring(k) .. ' of type: ' .. type(v))
nodeProperties[k] = v
for k, v in pairs(beam) do
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Beam prop: ' .. tostring(k) .. ' of type: ' .. type(v))
for k, v in pairs(beam) do
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Beam prop: ' .. tostring(k) .. ' of type: ' .. type(v))
for k, v in pairs(beam) do
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Beam prop: ' .. tostring(k) .. ' of type: ' .. type(v))
if type(v) == "string" or type(v) == "boolean" or type(v) == "number" then
-- log('I', 'damageEvaluation', 'Beam prop: ' .. tostring(k) .. ' of type: ' .. type(v))
beamProperties[k] = v
@/lua/ge/extensions/flowgraph/nodes/activity/getProgress.lua
local val = aggregate[k]
if type(val) == 'number' then
text = text .. string.format("%s: %0.2d. ", k, val or 0)
@/lua/vehicle/controller/pneumatics/autoLevelSuspension.lua
local function iterateGroups(groupNameOrNames)
if type(groupNameOrNames) == "string" then
groupNameOrNames = {groupNameOrNames}
@/gameplay/missionTypes/collection/customNodes/collectionMarkersNode.lua
if type(clr) == 'number' then
clr = rainbowColor(36,(0.05+(0.75*clr))*12, 1)
local clr = m.colorTimer
if type(clr) == 'number' then
clr = clr - clr%(0.05)
local clr = m.colorTimer
if type(clr) == 'number' then
clr = clr - clr%(0.05)
@/lua/ge/extensions/campaign/comics.lua
for i=1,numberPanels do
if type(comicData.order[i]) == 'string' then
local panel = comicData.order[i] ..'/'
@/lua/ge/client/postFx.lua
local flag = string.format("$PostFXManager::Settings::%s", key)
if type(obj) ~= "table" then
TorqueScriptLua.setVar(flag, obj)
@/lua/ge/extensions/util/screenshotCreator.lua
-- Sanitizing workOptions
if not workOptions or type(workOptions) ~= 'table' then
workOptions = {
@/lua/ge/extensions/gameplay/drag/utils.lua
local boundary = dragData.strip.lanes[playerLane].boundary.transform
if not boundary or type(boundary) ~= "table" then
log('E', logTag, 'No valid boundary found for racer: ' .. racer.vehId)
@/lua/ge/extensions/editor/fileDialog.lua
local function checkPattern(file, pattern)
if type(pattern) == "string" then
if file.name:match(".*("..pattern..")$") == nil then
return true
elseif type(pattern) == "table" then
local res = false
local pattern = nil
local suffixType = type(options.suffix[fileTypeSelected][2])
if suffixType == 'string' then
if not options.select_folder and (type(pattern) == "table" or (type(pattern) == 'string' and pattern ~= "*")) then
if s.filetype == "file" then
if not options.select_folder and (type(pattern) == "table" or (type(pattern) == 'string' and pattern ~= "*")) then
if s.filetype == "file" then
local function getFiletypeLabel(suffix)
if type(suffix[2]) == "string" then
return suffix[1].."(*"..suffix[2]..")"
return suffix[1].."(*"..suffix[2]..")"
elseif type(suffix[2]) == "table" then
local res = suffix[1] .."("
end
if not callbackFn or type(callbackFn) ~= "function" then
log("E", "_fileDialog", "Callback function is invalid")
end
if not defaultPath or (type(defaultPath) == "string" and #defaultPath == 0) then
log("W", "_fileDialog", "'defaultPath' should not be empty")
@/lua/ge/extensions/util/configListGenerator.lua
for _, value in ipairs(parameters) do
if type(vehicleValueDict) == 'table' then
if vehicleValueDict[value] then
local value = vehicleInfo[filterName] or (vehicleInfo.aggregates[filterName] and vehicleInfo.aggregates[filterName].min)
if not value or type(value) ~= "number" then return false end
if parameters.min and (value < parameters.min) or parameters.max and (value > parameters.max) then
@/lua/ge/extensions/editor/logHelper.lua
if type(t.errors) == 'number' and t.errors > 0 then
im.TextColored(im.ImVec4(1.0, 0.0, 0.0, 1.0), tostring(t.errors) .. 'E ')
end
if type(t.warnings) == 'number' and t.warnings > 0 then
im.TextColored(im.ImVec4(1.0, 1.0, 0.0, 1.0), tostring(t.warnings) .. 'W')
@/lua/ge/extensions/gameplay/util/sortedList.lua
function C:remove(obj)
if type(obj) == 'number' then
obj = self.objects[obj]
@/lua/vehicle/electrics.lua
else
if type(v) == "boolean" then
vals[f] = vals[f] and 1 or 0
@/ui/lib/ext/angular-translate/angular-translate-interpolation-messageformat/angular-translate-interpolation-messageformat.js
// Ensure explicit type if possible
// MessageFormat checks the actual type (i.e. for amount based conditions)
for (var key in interpolationParams) {
@/lua/ge/extensions/core/online.lua
--print('=== downloadURL ===')
--print(' uri = ' .. dumps(uri) .. ' / ' .. type(uri))
--print(' finishCallback = ' .. dumps(finishCallback) .. ' / ' .. type(finishCallback))
--print(' uri = ' .. dumps(uri) .. ' / ' .. type(uri))
--print(' finishCallback = ' .. dumps(finishCallback) .. ' / ' .. type(finishCallback))
--print(' postDataTbl = ' .. dumps(postDataTbl) .. ' / ' .. type(postDataTbl))
--print(' finishCallback = ' .. dumps(finishCallback) .. ' / ' .. type(finishCallback))
--print(' postDataTbl = ' .. dumps(postDataTbl) .. ' / ' .. type(postDataTbl))
--print(' outfile = ' .. dumps(outfile) .. ' / ' .. type(outfile))
--print(' postDataTbl = ' .. dumps(postDataTbl) .. ' / ' .. type(postDataTbl))
--print(' outfile = ' .. dumps(outfile) .. ' / ' .. type(outfile))
--print(' reqType = ' .. dumps(reqType) .. ' / ' .. type(reqType))
--print(' outfile = ' .. dumps(outfile) .. ' / ' .. type(outfile))
--print(' reqType = ' .. dumps(reqType) .. ' / ' .. type(reqType))
--print(' progressCallback = ' .. dumps(progressCallback) .. ' / ' .. type(progressCallback))
--print(' reqType = ' .. dumps(reqType) .. ' / ' .. type(reqType))
--print(' progressCallback = ' .. dumps(progressCallback) .. ' / ' .. type(progressCallback))
--print(' isJson = ' .. dumps(isJson) .. ' / ' .. type(isJson))
--print(' progressCallback = ' .. dumps(progressCallback) .. ' / ' .. type(progressCallback))
--print(' isJson = ' .. dumps(isJson) .. ' / ' .. type(isJson))
r.pub.responseCode = responseCode
if type(responseresponseHeadersBuffer) == 'string' and string.len(responseHeaders) > 0 then
r.pub.responseHeaders = responseHeaders
end
if type(responseBuffer) == 'string' and string.len(responseBuffer) > 0 then
r.pub.responseBuffer = responseBuffer
end
if type(responseData) == 'table' and not tableIsEmpty(responseData) then
r.pub.responseData = responseData
if not data.origin or data.origin ~= 'gameauth' or type(data.cmds) ~= 'table' then
log('E', 'online.onInstructions', 'unknown instructions. Discarded: ' .. dumps(data))
@/lua/vehicle/powertrain/automaticGearbox.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
for k, v in pairs(jbeamData.gearRatios) do
if type(k) == "number" then
table.insert(v >= 0 and forwardGears or reverseGears, v)
local gearWhineCoefsOutput = jbeamData.gearWhineCoefsOutput or jbeamData.gearWhineCoefs
if gearWhineCoefsOutput and type(gearWhineCoefsOutput) == "table" then
local gearIndex = device.minGearIndex
local gearWhineCoefsInput = jbeamData.gearWhineCoefsInput or jbeamData.gearWhineCoefs
if gearWhineCoefsInput and type(gearWhineCoefsInput) == "table" then
local gearIndex = device.minGearIndex
if jbeamData.gearboxNode_nodes and type(jbeamData.gearboxNode_nodes) == "table" then
device.transmissionNodeID = jbeamData.gearboxNode_nodes[1]
if type(device.transmissionNodeID) ~= "number" then
device.transmissionNodeID = nil
@/lua/ge/extensions/ui/vehicleSelector/general.lua
local min, max = propVal, propVal
if type(propVal) == 'table' then
min = propVal.min
end
if type(min) == 'number' and type(max) == 'number' then
if not filterByProp[propName] then
end
if type(min) == 'number' and type(max) == 'number' then
if not filterByProp[propName] then
end
if type(propVal) == 'string' then
if string.find(string.lower(propVal), searchTextLower, 1, true) then
elseif filter.type == 'range' then
if propVal == "Other..." or not type(propVal) == 'number' then
return false
end
if type(propVal) == 'table' then
if (propVal.min and propVal.min < filter.currentMin) or (propVal.max and propVal.max > filter.currentMax) then
@/lua/ge/extensions/core/commandhandler.lua
local functionName = data
if type(extensions[cmd][functionName]) == "function" then
extensions[cmd][functionName]()
local functionName = table.remove(params, 1)
if type(extensions[cmd][functionName]) == "function" then
extensions[cmd][functionName](unpack(params))
@/lua/ge/extensions/editor/flowgraph/properties.lua
local k = orderedKeys[1]
self:_drawInputField(path .. k .. '_val', cdata, type(v[k]), v[k], savePath .. k, function(_savePath, newVal) v[k] = newVal ; if saveCallback then saveCallback(_savePath, newVal) end ; end, true)
else
if keysEditable then
self:_drawInputField(path .. k .. '_key', cdata, type(k), k, savePath .. k, function(_savePath, newKey)
v[newKey] = v[k]
im.NextColumn()
self:_drawInputField(path .. k .. '_val', cdata,type(v[k]), v[k], savePath .. k,
function(_savePath, newVal)
if not pin.fixed then
if type(pin.type) ~= 'table' then
if im.BeginCombo("##pinType" .. pin.id, pin.type) then
if pin.type == 'any' or type(pin.type) == 'table' then
local allowedTypes = ui_flowgraph_editor.getSimpleTypes()
local allowedTypes = ui_flowgraph_editor.getSimpleTypes()
if type(pin.type) == 'table' then allowedTypes = pin.type end
im.PushItemWidth(100)
if not pin.fixed then
if type(pin.type) ~= 'table' then
if im.BeginCombo("##pinType" .. pin.id, pin.type) then
if pin.type == 'any' or type(pin.type) == 'table' then
local allowedTypes = ui_flowgraph_editor.getSimpleTypes()
local allowedTypes = ui_flowgraph_editor.getSimpleTypes()
if type(pin.type) == 'table' then allowedTypes = pin.type end
im.PushItemWidth(100)
self:drawItemHeader(node)
if type(node.drawCustomProperties) == 'function' then
--if im.TreeNodeEx1("Properties##"..node.id,im.TreeNodeFlags_DefaultOpen) then
if reason then
if type(reason) == 'string' then
self.fgEditor.addHistory("Custom Property Change of node " .. node.name..": " .. reason)
@/lua/vehicle/powertrain/cvtGearbox.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
if jbeamData.gearboxNode_nodes and type(jbeamData.gearboxNode_nodes) == "table" then
device.transmissionNodeID = jbeamData.gearboxNode_nodes[1]
@/inspector/Models/ConsoleMessage.js
get messageText() { return this._messageText; }
get type() { return this._type; }
get url() { return this._url; }
@/lua/common/jbeam/utils.lua
local n
if type(options) == 'table' then
n = deepcopy(options)
local b
if type(options) == 'table' then
b = deepcopy(options)
for nodeKey, data in pairs(jbeamData) do
if type(nodeKey) == 'string' and type(data) == 'table' and type(data.x) == 'number' and type(data.y) == 'number' and type(data.z) == 'number'
and byte(nodeKey,4) == 101 and byte(nodeKey,3) == 100 and byte(nodeKey,2) == 111 and byte(nodeKey,1) == 110 then
for nodeKey, data in pairs(jbeamData) do
if type(nodeKey) == 'string' and type(data) == 'table' and type(data.x) == 'number' and type(data.y) == 'number' and type(data.z) == 'number'
and byte(nodeKey,4) == 101 and byte(nodeKey,3) == 100 and byte(nodeKey,2) == 111 and byte(nodeKey,1) == 110 then
for nodeKey, data in pairs(jbeamData) do
if type(nodeKey) == 'string' and type(data) == 'table' and type(data.x) == 'number' and type(data.y) == 'number' and type(data.z) == 'number'
and byte(nodeKey,4) == 101 and byte(nodeKey,3) == 100 and byte(nodeKey,2) == 111 and byte(nodeKey,1) == 110 then
for nodeKey, data in pairs(jbeamData) do
if type(nodeKey) == 'string' and type(data) == 'table' and type(data.x) == 'number' and type(data.y) == 'number' and type(data.z) == 'number'
and byte(nodeKey,4) == 101 and byte(nodeKey,3) == 100 and byte(nodeKey,2) == 111 and byte(nodeKey,1) == 110 then
for nodeKey, data in pairs(jbeamData) do
if type(nodeKey) == 'string' and type(data) == 'table' and type(data.x) == 'number' and type(data.y) == 'number' and type(data.z) == 'number'
and byte(nodeKey,4) == 101 and byte(nodeKey,3) == 100 and byte(nodeKey,2) == 111 and byte(nodeKey,1) == 110 then
if op.px or op.py or op.pz then
local px = (op.px and type(op.px)=='number') and op.px or 0
local py = (op.py and type(op.py)=='number') and op.py or 0
local px = (op.px and type(op.px)=='number') and op.px or 0
local py = (op.py and type(op.py)=='number') and op.py or 0
local pz = (op.pz and type(op.pz)=='number') and op.pz or 0
local py = (op.py and type(op.py)=='number') and op.py or 0
local pz = (op.pz and type(op.pz)=='number') and op.pz or 0
@/lua/ge/extensions/util/docCreator.lua
local function cleanupTable(job, tbl)
if type(tbl) == 'table' then
for k, v in pairs(tbl) do
for k, v in pairs(tbl) do
if type(v) == 'table' then
cleanupTable(job, v)
cleanupTable(job, v)
elseif type(v) == 'string' then
tbl[k] = translateLanguage(v, v, true) -- true = silent logs
for _, level in ipairs(levels) do
if type(level.size) == 'table' and #level.size > 1 then
if level.size[1] == -1 and level.size[2] == -1 then
@/lua/ge/extensions/gameplay/drift/general.lua
}
if type(ext) == "table" then
if ext.getDriftDebugInfo then
@/lua/ge/extensions/editor/api/gui.lua
local function getTempBool_StringString(value)
local valueType = type(value)
local function getTempFloatArray2_TableTable(value)
if value and type(value) == 'table' then
if #value == 2 then
local function getTempFloatArray3_TableTable(value)
if value and type(value) == 'table' then
if #value == 3 then
local function getTempFloatArray3_Vec3Vec3(value)
if value and type(value) == 'cdata' then
tempFloatArr3[0] = value.x
local function getTempFloatArray4_TableTable(value)
if value and type(value) == 'table' then
if #value == 4 then
local function getTempImVec4_TableTable(value)
if value and type(value) == 'table' then
if #value == 4 then
local function getTempImVec4_TableImVec4(value)
if value and type(value) == 'table' then
if #value == 4 then
if mEvenColor == nil then mEvenColor = defaultAlternateRowsColors[2] end
if type(mOddColor) ~= 'cdata' or type(mEvenColor) ~= "cdata" then return end
local function testOddImColor() mOddColor = mOddColor.Value end
if mEvenColor == nil then mEvenColor = defaultAlternateRowsColors[2] end
if type(mOddColor) ~= 'cdata' or type(mEvenColor) ~= "cdata" then return end
local function testOddImColor() mOddColor = mOddColor.Value end
@/inspector/Models/TimelineRecord.js
get type()
{
@/lua/ge/extensions/scenario/scenarios.lua
if scenario.vehicles[vName].driver["command"] then
if type(scenario.vehicles[vName].driver["command"]) == "table" then
for i,v in pairs(scenario.vehicles[vName].driver["command"]) do
end
elseif type(scenario.vehicles[vName].driver["command"]) == "string" then
helper.queueLuaCommandByName(vName, scenario.vehicles[vName].driver["command"])
initialLevelState = {}
if type(scenario.levelObjects) ~= 'table' then return end
for objName, objFields in pairs(scenario.levelObjects) do
for _, e in ipairs(scenario.extensions) do
if type(e) == 'table' and e.loaded then
extensions.unload(e.extName)
extensions.unload(e.extName)
elseif type(e) == 'string' then
extensions.unload('scenario_' .. e)
-- load any scenario vehicle extensions
if type(vehicleConf.extensions) == 'table' then
for vek, ve in pairs(vehicleConf.extensions) do
inputActionFilter.clear(0)
if type(scenario.blackListActions) == 'table' then
for i, action in ipairs( scenario.blackListActions ) do
if type(scenario.whiteListActions) == 'table' then
for i, action in ipairs( scenario.whiteListActions ) do
for _,entry in ipairs(scenario.lapConfig or {}) do
if type(entry) == 'string' then
if not tableContains(triggers, entry) and not tableContains(waypoints, entry) and entry:sub(1,12) ~= '__generated_' then
for _, e in ipairs(scenario.extensions) do
if type(e) == 'table' then
local moduleFullPath = scenario.directory.."/"..e.name
end
elseif type(e) == 'string' then
-- Looks in ge/extensions/scenario for these type of modules
local extName = nil
if type(e) == 'table' and e.loaded and e.extName then
extName = e.extName
extName = e.extName
elseif type(e) == 'string' then
extName = 'scenario_' .. e
endUIDisplayed = true
if scenario.endScreenController and type(scenario.endScreenController) == 'function' then
scenario.endScreenController()
inputActionFilter.clear(0)
if type(scenario.blackListActions) == 'table' then
for i, action in ipairs( scenario.blackListActions ) do
if type(scenario.whiteListActions) == 'table' then
for i, action in ipairs( scenario.whiteListActions ) do
__index = function(tbl, key)
if scenario_scenarios and scenario_scenarios[key] and type(scenario_scenarios[key]) == 'function' then
return function(...)
@/inspector/Models/Cookie.js
get type() { return this._type; }
get name() { return this._name; }
@/inspector/Models/Resource.js
get target() { return this._target; }
get type() { return this._type; }
get loaderIdentifier() { return this._loaderIdentifier; }
@/lua/ge/extensions/flowgraph/nodes/math/math.lua
local index = 0
local selectorType = type(selector)
local val = table.__pinIn[key].value
if type(val) == 'table' then
if val[4] then
end
if type(result) == 'cdata' then
if ffi.istype('struct __luaVec3_t', result) then
@/lua/ge/extensions/flowgraph/graph.lua
local node = orderList[i]
if type(node._afterTrigger) == 'function' then
table.insert(fun, '\n orderList[' .. i .. ']:_afterTrigger()')
function C:deleteNode(node, ignoreIntegratedNodes)
if not node or type(node.id) ~= 'number' then
log('E', self.mgr.logTag, 'Graph.deleteNode. Invalid node: ' .. dumpsz(node, 2))
function C:deleteLink(link)
if not link or type(link.id) ~= 'number' then
log('E', self.mgr.logTag, 'Graph.deleteLink. Invalid link: ' .. dumpsz(link, 2))
end
if type(data.name) == 'string' then
self.name = data.name
end
if type(data.type) == 'string' then
self.type = data.type
local sourceTypes = {}
if type(targetPin.type) ~= 'table' then
targetTypes[targetPin.type] = 1
if type(sourcePin.type) ~= 'table' then
sourceTypes[sourcePin.type] = 1
@/gameplay/missionTypes/crawl/customNodes/getDynamicObjectsFromPrefabNode.lua
for _, value in pairs(dF or {}) do
if type(value) == "string" and value == self.pinIn.dynamicName.value then
table.insert(dynamicObjects, id)
@/lua/ge/extensions/flowgraph/nodes/scene/collectionMarker.lua
if type(clr) == 'number' then
clr = rainbowColor(36,(0.8-(0.75*clr))*12, 1)
@/lua/ge/extensions/core/trailerRespawn.lua
for previousId, connectionInfo in pairs(trailerReg) do
if type(connectionInfo) == "table" and connectionInfo.trailerId == vehId then
return previousId
if trailerReg[vehId] then
log("D", logTag, "Unregistered vehicle "..tostring(vehId).."; trailer was ".. (type(trailerReg[vehId]) == "table" and tostring(trailerReg[vehId].trailerId) or trailerReg[vehId]))
trailerReg[vehId] = nil
@/lua/common/jbeam/tableSchema.lua
local function replaceSpecialValues(val)
local typeval = type(val)
if typeval == "table" then
local function processJbeamTableRow(ctx, rowValue)
if type(rowValue) ~= "table" then
log('W', "", "*** Invalid table row: "..dumps(rowValue))
local rowValueSize = #rowValue
--log('D', "" *** "..tostring(ctx.rowCounter).." = "..tostring(rowValue).." ["..type(rowValue).."]")
-- allow last type to be the options always
if rowValueSize > ctx.headerSize1 then -- and type(rowValue[#rowValue]) ~= "table" then
if not ctx.omitWarnings then
local disableRow = (newRow.disable == true) or (type(newRow.variables) == 'table' and newRow.variables.disable == true)
local header = jbeamTable[1]
if type(header) ~= "table" then
if not omitWarnings then
for keyEntry, entry in pairs(vehicle) do
if type(entry) ~= "table" then
-- seems to be a option, add it to the vehicle options
--[[
if type(entry) == "table" and tableIsDict(entry) then
log('D', ""," ** "..tostring(keyEntry).." = [DICT] #" ..tableSize(entry))
log('D', ""," ** "..tostring(keyEntry).." = [DICT] #" ..tableSize(entry))
elseif type(entry) == "table" and not tableIsDict(entry) then
log('D', ""," ** "..tostring(keyEntry).." = [LIST] #"..tableSize(entry))
else
log('D', ""," ** "..tostring(keyEntry).." = "..tostring(entry).." ["..type(entry).."]")
end
-- then walk the tables
if type(entry) == "table" and not tableIsDict(entry) and jbeamUtils.ignoreSections[keyEntry] == nil and not tableIsEmpty(entry) then
if tableIsDict(entry) then
@/lua/vehicle/controller/propAnimation/hPattern.lua
relevantGearbox = powertrain.getDevice(gearboxName)
if type(jbeamData.shiftSoundNode_nodes) == "table" and jbeamData.shiftSoundNode_nodes[1] and type(jbeamData.shiftSoundNode_nodes[1]) == "number" then
shiftSoundNodeId = jbeamData.shiftSoundNode_nodes[1]
relevantGearbox = powertrain.getDevice(gearboxName)
if type(jbeamData.shiftSoundNode_nodes) == "table" and jbeamData.shiftSoundNode_nodes[1] and type(jbeamData.shiftSoundNode_nodes[1]) == "number" then
shiftSoundNodeId = jbeamData.shiftSoundNode_nodes[1]
@/lua/ge/extensions/gameplay/drift/saveLoad.lua
for _, elem in ipairs(json.stuntZones or {}) do
if elem.pos and type(elem.pos) == "table" and elem.pos.x and elem.pos.y and elem.pos.z then elem.pos = vec3(elem.pos) end
if elem.rot and type(elem.rot) == "table" and elem.rot.x and elem.rot.y and elem.rot.z and elem.rot.w then elem.rot = quat(elem.rot) end
if elem.pos and type(elem.pos) == "table" and elem.pos.x and elem.pos.y and elem.pos.z then elem.pos = vec3(elem.pos) end
if elem.rot and type(elem.rot) == "table" and elem.rot.x and elem.rot.y and elem.rot.z and elem.rot.w then elem.rot = quat(elem.rot) end
if elem.scl and type(elem.scl) == "table" and elem.scl.x and elem.scl.y and elem.scl.z then elem.scl = vec3(elem.scl) end
if elem.rot and type(elem.rot) == "table" and elem.rot.x and elem.rot.y and elem.rot.z and elem.rot.w then elem.rot = quat(elem.rot) end
if elem.scl and type(elem.scl) == "table" and elem.scl.x and elem.scl.y and elem.scl.z then elem.scl = vec3(elem.scl) end
if elem.scl and type(elem.scl) == "number" then end
if elem.scl and type(elem.scl) == "table" and elem.scl.x and elem.scl.y and elem.scl.z then elem.scl = vec3(elem.scl) end
if elem.scl and type(elem.scl) == "number" then end
end
@/lua/ge/extensions/gameplay/traffic/trafficUtils.lua
country = string.split(info.country, "%w+") -- splits the translation string, if applicable
if type(country) == 'table' and country[1] then
country = string.lower(country[#country])
@/lua/common/libs/resty/template.lua
if s == nil or s == null then return "" end
if type(s) == "function" then return template.output(s()) end
return tostring(s)
function template.escape(s, c)
if type(s) == "string" then
if c then return gsub(s, "[}{\">/<'&]", CODE_ENTITIES) end
if layout then
if type(layout) == "table" then
return setmetatable({ render = function(self, context)
@/lua/vehicle/powertrain/hydraulicAccumulator.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/inspector/Models/BreakpointAction.js
get id() { return this._id; }
get type() { return this._type; }
@/lua/ge/extensions/gameplay/police.lua
-- useLength can be nil
if type(vehIds) ~= 'table' then return end
rbWidth = rbWidth or 10 -- maximum roadblock width
local function placeRoadblock(vehIds, pos, rot, placeData) -- places a roadblock
if type(vehIds) ~= 'table' or not pos or not rot then return end
placeData = placeData or {}
local function setPursuitVars(data) -- sets various traffic variables
if type(data) ~= 'table' then
if not data then resetPursuitVars() end
policeIds = tableKeys(policeVehs) -- use all police vehicles
elseif type(policeIds) == 'number' then -- backwards compatibility
policeIds = {policeIds}
@/lua/common/libs/StackTracePlus/StackTracePlus.lua
local function safe_tostring (value)
if type(value) == "userdata" or type(value) == "cdata" then
-- we avoid inspecting inside these values: tostring() could crash to desktop when the object was deleted in C side (for example, when __tostring() accesses an invalid mem address)
local function safe_tostring (value)
if type(value) == "userdata" or type(value) == "cdata" then
-- we avoid inspecting inside these values: tostring() could crash to desktop when the object was deleted in C side (for example, when __tostring() accesses an invalid mem address)
-- we avoid inspecting inside these values: tostring() could crash to desktop when the object was deleted in C side (for example, when __tostring() accesses an invalid mem address)
return type(value)..": (...)"
end
local function ParseLine(line)
assert(type(line) == "string")
--print(line)
--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")
-- in the same thread we're inspecting)
if type(thread) == "thread" then
t.getinfo = function(level, what)
t.getinfo = function(level, what)
if t.dumping_same_thread and type(level) == "number" then
level = level + 1
while name do
if type(value) == "number" then
self:add_f("%s%s = number: %g\n", prefix, name, value)
self:add_f("%s%s = number: %g\n", prefix, name, value)
elseif type(value) == "boolean" then
self:add_f("%s%s = boolean: %s\n", prefix, name, tostring(value))
self:add_f("%s%s = boolean: %s\n", prefix, name, tostring(value))
elseif type(value) == "string" then
local stringlen = #value
end
elseif type(value) == "userdata" then
self:add_f("%s%s = %s\n", prefix, name, safe_tostring(value))
self:add_f("%s%s = %s\n", prefix, name, safe_tostring(value))
elseif type(value) == "cdata" then
self:add_f("%s%s = %s\n", prefix, name, safe_tostring(value))
self:add_f("%s%s = %s\n", prefix, name, safe_tostring(value))
elseif type(value) == "nil" then
self:add_f("%s%s = nil\n", prefix, name)
self:add_f("%s%s = nil\n", prefix, name)
elseif type(value) == "table" then
if m_known_tables[value] then
end
elseif type(value) == "function" then
local info = self.getinfo(value, "nS")
end
elseif type(value) == "thread" then
self:add_f("%sthread %q = %s\n", prefix, name, tostring(value))
else
self:add_f("%s%s = %s: (unrecognized type)\n", prefix, name, type(value))
end
function _M.stacktraceSimple(thread, message, level, level_limit, dump_locals)
if type(thread) ~= "thread" then
-- shift parameters left
if type(message) == "table" then
dumper:add("an error object {\n")
original_error = dumper:concat_lines()
elseif type(message) == "string" then
dumper:add(message)
--print(info.namewhat, info.name)
--for k,v in pairs(info) do print(k,v, type(v)) end
local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name or tostring(info.func)
--print("tail")
--for k,v in pairs(info) do print(k,v, type(v)) end--print(info.namewhat, info.name)
dumper:add_f("\n(%d) tail call", level_to_show)
if not function_name or function_name == "?" then
--for k,v in pairs(info) do print(k,v, type(v)) end
function_name = GuessFunctionName(info)
function _M.stacktrace(thread, message, level, level_limit, dump_locals)
if type(thread) ~= "thread" then
-- shift parameters left
if type(message) == "table" then
dumper:add("an error object {\n")
original_error = dumper:concat_lines()
elseif type(message) == "string" then
dumper:add(message)
--print(info.namewhat, info.name)
--for k,v in pairs(info) do print(k,v, type(v)) end
local function_name = m_user_known_functions[info.func] or m_known_functions[info.func] or info.name or tostring(info.func)
--print("tail")
--for k,v in pairs(info) do print(k,v, type(v)) end--print(info.namewhat, info.name)
dumper:add_f("(%d) tail call\n", level_to_show)
if not function_name or function_name == "?" then
--for k,v in pairs(info) do print(k,v, type(v)) end
function_name = GuessFunctionName(info)
@/ui/lib/ext/vue3/vue.global.js
/**
* Parse a tag (E.g. ``) with that type (start tag or end tag).
*/
@/lua/ge/extensions/gameplay/missions/missionTypes/editorHelper.lua
if valueOptions.oneDimScale == nil and valueOptions.defaultScl then valueOptions.oneDimScale = type(valueOptions.defaultScl)=='number' end
elem.oneDimScale = valueOptions.oneDimScale or false
-- filepath can be a table, allowing for one of the files to be required
if type(filepathsInMissionfolder) == 'string' then
filepathsInMissionfolder = {filepathsInMissionfolder}
element.displayOptions = element.displayOptions or {}
if element.displayOptions.associatedStars and type(element.displayOptions.associatedStars) == 'string' then
local key = element.displayOptions.associatedStars
end
if mtd[val.fieldName] ~= nil and element.defaultValue ~= nil and (type(mtd[val.fieldName]) ~= type(element.defaultValue)) then
table.insert(issues, {label = 'Mismatched Missiontype Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(mtd[val.fieldName]), type(element.defaultValue)), data=val, severity='error', fixable=true})
end
if mtd[val.fieldName] ~= nil and element.defaultValue ~= nil and (type(mtd[val.fieldName]) ~= type(element.defaultValue)) then
table.insert(issues, {label = 'Mismatched Missiontype Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(mtd[val.fieldName]), type(element.defaultValue)), data=val, severity='error', fixable=true})
if mtd[val.fieldName] ~= nil and element.defaultValue ~= nil and (type(mtd[val.fieldName]) ~= type(element.defaultValue)) then
table.insert(issues, {label = 'Mismatched Missiontype Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(mtd[val.fieldName]), type(element.defaultValue)), data=val, severity='error', fixable=true})
end
if mtd[val.fieldName] ~= nil and element.defaultValue ~= nil and (type(mtd[val.fieldName]) ~= type(element.defaultValue)) then
table.insert(issues, {label = 'Mismatched Missiontype Value: ' .. val.fieldName .. string.format(" (%s, should be %s)", type(mtd[val.fieldName]), type(element.defaultValue)), data=val, severity='error', fixable=true})
end
@/lua/common/utils/languageMap.lua
local lcomp = split(kclean, '_')
if type(lcomp) ~= 'table' or #lcomp == 0 then
return key
-- language first
if #lcomp > 0 and type(lcomp[1]) == 'string' then
res = res .. (M.languages[lcomp[1]] or lcomp[1])
-- then country
if #lcomp > 1 and type(lcomp[2]) == 'string' then
res = res .. ' (' .. (M.countries[string.upper(lcomp[2])] or lcomp[2]) .. ')'
@/lua/ge/extensions/core/vehicle/colors.lua
for attribute, value in pairs(paint) do
if type(value) == "table" then
for j, value2 in ipairs(value) do
@/lua/ge/extensions/editor/util/vehicleSelectUtil.lua
if type(paintTbl) == "table" then
if paintTbl.baseColor then
@/lua/ge/extensions/ui/gridSelectorUtils/translateHelper.lua
local function processNestedTranslations(text)
if not text or type(text) ~= "string" then
return text
local function translate(key)
if not key or type(key) ~= "string" then
return key or "Missing Translation Key!"
@/lua/ge/extensions/editor/gen/ui.lua
-- end
if mlist and #mlist > 0 and type(mlist[1]) == 'table' then
for i = 1,#mlist do
end
-- U.dump(list, '??*********** for_list:'..tp..':'..tostring(#list[1])..':'..tostring(type(list[1])))
-- _dbgone = true
end
-- U.dump(mlist,'?? if_LIST2:'..tp..':'..tostring(meshType)) --type(mlist[1])..':'..tostring(mlist and #mlist or nil))
break
@/lua/ge/extensions/core/windowsConsole.lua
local function onExtensionLoaded()
if type(consoleClearAvailableContexts) == 'nil' then
-- sorry, not available on your platform :(
@/lua/vehicle/extensions/tech/LINBus/LINBusPeak.lua
TLINDirection Direction; // #2 +2 Frame Direction (see Message Direction Types)
TLINChecksumType ChecksumType; // #3 +3 Frame Checksum type (see Message Checksum Types)
BYTE Data[8]; // #4 +4 Data bytes (0..7)
typedef struct { // Size = 40 bytes
TLINMsgType Type; // #0 +0 Frame type (see Received Message Types)
BYTE FrameId; // #1 +1 Frame ID (6 bit) + Parity (2 bit)
TLINDirection Direction; // #3 +3 Frame Direction (see Message Direction Types)
TLINChecksumType ChecksumType; // #4 +4 Frame Checksum type (see Message Checksum Types)
BYTE Data[8]; // #5 +5 Data bytes (0..7)
TLINDirection Direction; // #2 +2 Frame Direction (see Message Direction Types)
TLINChecksumType ChecksumType; // #3 +3 Frame Checksum type (see Message Checksum Types)
WORD Flags; // #4 +4 Frame flags (see Frame flags for LIN Msgs)
@/lua/common/libs/xlsxlib/tests/TestManager.lua
for name, func in pairs(tests) do
if type(func) == "function" and name:match("^test") then
table.insert(testNames, name)
@/lua/common/jbeam/sections/camera.lua
d[k] = nil
elseif type(v) == 'table' then
cleanCameraData(v)
for icKey, icam in pairs(vehicle.cameras.onboard) do
if type(icam.x) == 'number' and type(icam.y) == 'number' and type(icam.z) == 'number' then
icam.x, icam.y, icam.z = jbeamUtils.getPosAfterNodeRotateOffsetMove(icam, icam.x, icam.y, icam.z)
for icKey, icam in pairs(vehicle.cameras.onboard) do
if type(icam.x) == 'number' and type(icam.y) == 'number' and type(icam.z) == 'number' then
icam.x, icam.y, icam.z = jbeamUtils.getPosAfterNodeRotateOffsetMove(icam, icam.x, icam.y, icam.z)
for icKey, icam in pairs(vehicle.cameras.onboard) do
if type(icam.x) == 'number' and type(icam.y) == 'number' and type(icam.z) == 'number' then
icam.x, icam.y, icam.z = jbeamUtils.getPosAfterNodeRotateOffsetMove(icam, icam.x, icam.y, icam.z)
for icKey, icam in pairs(vehicle.cameras.onboard) do
if type(icam.x) == 'number' and type(icam.y) == 'number' and type(icam.z) == 'number' then
local cr = {}
for icKey, icam in pairs(vehicle.cameras.onboard) do
if type(icam.x) == 'number' and type(icam.y) == 'number' and type(icam.z) == 'number' then
local cr = {}
for icKey, icam in pairs(vehicle.cameras.onboard) do
if type(icam.x) == 'number' and type(icam.y) == 'number' and type(icam.z) == 'number' then
local cr = {}
-- automatic numeric naming
if v.name == nil or type(v.name) ~= 'string' then
v.name = 'onboard_' .. tostring(counter)
@/lua/common/libs/lustach/src/lustache/renderer.lua
local function is_array(array)
if type(array) ~= "table" then return false end
local max, n = 0, 0
for k, _ in pairs(array) do
if not (type(k) == "number" and k > 0 and math_floor(k) == k) then
return false
tags = tags or self.tags
if type(tokens) == "string" then
tokens = self:parse(tokens, tags)
function renderer:render(template, view, partials)
if type(self) == "string" then
error("Call mustache:render, not mustache.render!")
if type(value) == "table" then
if is_array(value) then
return callback(context:push(value), self)
elseif type(value) == "function" then
local section_text = string_sub(originalTemplate, token.endIndex+1, token.closingTagIndex - 1)
if value == nil or value == false or (type(value) == "table" and is_array(value) and #value == 0) then
return callback(context, self)
if type(value) == "function" then
value = value(context.view)
@/lua/common/libs/luamqtt/mqtt/protocol4.lua
if args.clean ~= nil then
assert(type(args.clean) == "boolean", "expecting .clean to be a boolean")
if args.clean then
-- check required args are presented
assert(type(args.will) == "table", "expecting .will to be a table")
assert(type(args.will.payload) == "string", "expecting .will.payload to be a string")
assert(type(args.will) == "table", "expecting .will to be a table")
assert(type(args.will.payload) == "string", "expecting .will.payload to be a string")
assert(type(args.will.topic) == "string", "expecting .will.topic to be a string")
assert(type(args.will.payload) == "string", "expecting .will.payload to be a string")
assert(type(args.will.topic) == "string", "expecting .will.topic to be a string")
if args.will.qos ~= nil then
if args.will.qos ~= nil then
assert(type(args.will.qos) == "number", "expecting .will.qos to be a number")
assert(check_qos(args.will.qos), "expecting .will.qos to be a valid QoS value")
if args.will.retain ~= nil then
assert(type(args.will.retain) == "boolean", "expecting .will.retain to be a boolean")
end
if args.username ~= nil then
assert(type(args.username) == "string", "expecting .username to be a string")
byte = bor(byte, lshift(1, 7))
if args.password ~= nil then
assert(type(args.password) == "string", "expecting .password to be a string")
assert(args.username, "the .username is required to set .password")
-- check args
assert(type(args.id) == "string", "expecting .id to be a string with MQTT client id")
-- DOC: 3.1.2.10 Keep Alive
if args.keep_alive then
assert(type(args.keep_alive) == "number")
keep_alive_ival = args.keep_alive
-- DOC: 3.1.3.2 Will Topic
assert(type(args.will.topic) == "string", "expecting will.topic to be a string")
payload:append(make_string(args.will.topic))
-- DOC: 3.1.3.3 Will Message
assert(args.will.payload == nil or type(args.will.payload) == "string", "expecting will.payload to be a string or nil")
payload:append(make_string(args.will.payload or ""))
-- check args
assert(type(args.topic) == "string", "expecting .topic to be a string")
if args.payload ~= nil then
if args.payload ~= nil then
assert(type(args.payload) == "string", "expecting .payload to be a string")
end
if args.qos ~= nil then
assert(type(args.qos) == "number", "expecting .qos to be a number")
assert(check_qos(args.qos), "expecting .qos to be a valid QoS value")
if args.retain ~= nil then
assert(type(args.retain) == "boolean", "expecting .retain to be a boolean")
end
if args.dup ~= nil then
assert(type(args.dup) == "boolean", "expecting .dup to be a boolean")
end
if args.qos and args.qos > 0 then
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.subscriptions) == "table", "expecting .subscriptions to be a table")
assert(#args.subscriptions > 0, "expecting .subscriptions to be a non-empty array")
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "table", "expecting .subscriptions["..i.."] to be a table")
assert(type(subscription.topic) == "string", "expecting .subscriptions["..i.."].topic to be a string")
assert(type(subscription) == "table", "expecting .subscriptions["..i.."] to be a table")
assert(type(subscription.topic) == "string", "expecting .subscriptions["..i.."].topic to be a string")
if subscription.qos ~= nil then
if subscription.qos ~= nil then
assert(type(subscription.qos) == "number", "expecting .subscriptions["..i.."].qos to be a number")
assert(check_qos(subscription.qos), "expecting .subscriptions["..i.."].qos to be a valid QoS value")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.subscriptions) == "table", "expecting .subscriptions to be a table")
assert(#args.subscriptions > 0, "expecting .subscriptions to be a non-empty array")
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "string", "expecting .subscriptions["..i.."] to be a string")
payload:append(make_string(subscription))
function protocol4.make_packet(args)
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.type) == "number", "expecting .type number in args")
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.type) == "number", "expecting .type number in args")
local ptype = args.type
@/inspector/Views/CanvasTabContentView.js
get type()
{
@/lua/ge/extensions/editor/flowgraphEditor.lua
snap.graph = mgr.graph
elseif type(graph) == "table" then
snap.graph = graph
@/inspector/Views/TabContentView.js
get type()
{
@/inspector/Models/ResourceQueryMatch.js
get type() { return this._type; }
get index() { return this._index; }
@/lua/ge/extensions/editor/missionEditor/general.lua
end
if type(self.mission.description) == "string" and translateLanguage(self.mission.description, self.mission.description, true) == self.mission.description then
table.insert(issues, {label = 'Description has no translation!', severity='warning'})
im.NextColumn()
if type(self.mission.description) == "string" or self.mission.description == nil then
editEnded = im.BoolPtr(false)
end
if type(self.mission.description) == "table" then
im.Text("Description is a table, editing is not supported!")
local str = self.mission.description
if type(str) == "table" and str.txt then
str = str.txt
@/lua/ge/extensions/campaign/campaignsLoader.lua
if name ~= 'campaign_campaigns' then
if _G[name] and type(_G[name].onResumeCampaign) == 'function' then
_G[name].onResumeCampaign(campaign, data)
@/lua/ge/extensions/scenario/raceGoals.lua
if k == id and kl==gkey then
if vl==type(val) then
return
if vl=="localizedString" then
if type(val) == "table" and type(val.txt)=="string" then
return
if vl=="localizedString" then
if type(val) == "table" and type(val.txt)=="string" then
return
end
if type(val) == "string" then
if not string.startswith(val, "scenarios.") then
end
if vl~=type(val) then
invalidType = true
for _,v in ipairs(scenario.goals.vehicles) do
if type(v.value) == "table" then
for gkey,val in pairs(v.value) do
for k, _ in pairs(t) do
if type(k) ~= "number" then
return true
@/lua/ge/extensions/core/repository.lua
end
if type(callback) == 'function' then
callback(r)
@/inspector/Models/Timeline.js
get type() { return this._type; }
get startTime() { return this._startTime; }
@/lua/vehicle/controller/tech/screens.lua
local function init(jbeamData)
if not jbeamData.screenDefinitions or type(jbeamData.screenDefinitions) ~= "table" or #jbeamData.screenDefinitions <= 0 then
log("E", "screens", "No screens defined!")
@/inspector/Protocol/Target.js
get type() { return this._type; }
get connection() { return this._connection; }
@/lua/vehicle/extensions/tech/ACC.lua
for k, v in pairs(simData) do
if type(v) == "table" then
if k == "closestVehicles1" then
if k2 == "velBB" then
if type(v2) == "cdata" then
local x = tonumber(v2.x)
@/lua/ge/extensions/flowgraph/nodes/ui/startScreen.lua
data.introType = self.pinIn.layout.value or 'htmlOnly'
if type(self.pinIn.text.value) == 'table' and #self.pinIn.text.value > 0 then
data.multiDescription = self.pinIn.text.value
@/lua/ge/extensions/flowgraph/nodes/ui/missionEndScreen.lua
statsData.text = ""
if type(self.pinIn.text.value) == 'table' then
statsData.multiDescription = self.pinIn.text.value
@/lua/ge/extensions/flowgraph/nodes/ui/endScreen.lua
if type(statsData.time) == 'number' then
local minutes = math.floor(statsData.time / 60)
end
if type(self.pinIn.text.value) == 'table' then
statsData.multiDescription = self.pinIn.text.value
for _, c in ipairs(change.list) do
if type(c.new) == 'number' then
statsData.text = statsData.text .. string.format("%s: %0.2d -> %0.2d", c.key, c.old, c.new)
@/lua/ge/map.lua
for _, v in pairs(jsonMap.segments) do
if type(v.nodes) == 'string' then
local nodeList = {}
local d = dif
if type(dif) == "table" then
d = dif.drivability or 0
if dataToCSV then
dataToCSV:write(type(s.logData) == 'string' and s.logData or nil)
end
if trajectoryToCSV2 then
trajectoryToCSV2:write(type(s.logTrajectory) == 'string' and s.logTrajectory or nil)
end
for k, v in pairs(M.objectNames) do
if type(k) == 'string' then
if M.objects[v] then
@/inspector/Views/ConsoleTabContentView.js
get type()
{
@/lua/vehicle/controller/vehicleController/shiftLogic/cvtGearbox2.lua
if type(jbeamData.cvtSportGearRatios) == "table" then
cvtHandling.fixedGearRatios = {}
for i, v in ipairs(jbeamData.cvtSportGearRatios) do
if type(v) ~= "number" then
log("W", "cvtGearbox2", "Invalid value #" .. tostring(i) .. " for fixedGearRatios (value was not a number)")
@/lua/vehicle/extensions/scenario/functionFreezer.lua
if func then
if type(func) == "function" then
table.insert(functionNames, functionString)
@/lua/ge/extensions/core/recoveryPrompt.lua
if add then
local enabled = type(option.enabled) == "function" and option.enabled(option, target) or option.enabled
local reason = nil
end
local label = type(option.label) == "function" and option.label(option, target) or option.label
if option.limit then
local price = type(option.price) == "function" and option.price(target) or option.price
if price and career_modules_payment and not career_modules_payment.canPay(price) then
@/lua/ge/extensions/util/inputSystemUtils.lua
if m then
if type(m.bindings) == 'table' then
bindingCount = bindingCount + #m.bindings
local function isValidVIdPId(vidpid)
if type(vidpid) ~= 'string' or vidpid:len() ~= 8 then
return false
if type(info.bindings) == 'table' then
table.sort(info.bindings, function(a, b)
@/lua/common/libs/luamqtt/mqtt/protocol5.lua
if args.clean ~= nil then
assert(type(args.clean) == "boolean", "expecting .clean to be a boolean")
if args.clean then
-- check required args are presented
assert(type(args.will) == "table", "expecting .will to be a table")
assert(type(args.will.payload) == "string", "expecting .will.payload to be a string")
assert(type(args.will) == "table", "expecting .will to be a table")
assert(type(args.will.payload) == "string", "expecting .will.payload to be a string")
assert(type(args.will.topic) == "string", "expecting .will.topic to be a string")
assert(type(args.will.payload) == "string", "expecting .will.payload to be a string")
assert(type(args.will.topic) == "string", "expecting .will.topic to be a string")
assert(type(args.will.qos) == "number", "expecting .will.qos to be a number")
assert(type(args.will.topic) == "string", "expecting .will.topic to be a string")
assert(type(args.will.qos) == "number", "expecting .will.qos to be a number")
assert(check_qos(args.will.qos), "expecting .will.qos to be a valid QoS value")
assert(check_qos(args.will.qos), "expecting .will.qos to be a valid QoS value")
assert(type(args.will.retain) == "boolean", "expecting .will.retain to be a boolean")
if args.will.properties ~= nil then
if args.will.properties ~= nil then
assert(type(args.will.properties) == "table", "expecting .will.properties to be a table")
end
if args.will.user_properties ~= nil then
assert(type(args.will.user_properties) == "table", "expecting .will.user_properties to be a table")
end
if args.username ~= nil then
assert(type(args.username) == "string", "expecting .username to be a string")
byte = bor(byte, lshift(1, 7))
if args.password ~= nil then
assert(type(args.password) == "string", "expecting .password to be a string")
assert(args.username, "the .username is required to set .password")
if args.properties ~= nil then
assert(type(args.properties) == "table", "expecting .properties to be a table")
-- validate all properties and append them to order list
for name, value in pairs(args.properties) do
assert(type(name) == "string", "expecting property name to be a string: "..tostring(name))
-- detect property identifier and check it's allowed for that packet type
if property_multiple[prop_id] then
assert(type(value) == "table", "expecting list-table for property with multiple value")
assert(#value == 1, "only one value for multiple-property supported")
-- and append it to props
if type(props) == "string" then
props = combine(prop)
if args.user_properties ~= nil then
assert(type(args.user_properties) == "table", "expecting .user_properties to be a table")
assert(allowed[uprop_id], "user_property is not allowed for packet type "..ptype)
for name, val in pairs(args.user_properties) do
local ntype = type(name)
if ntype == "string" then
if ntype == "string" then
if type(val) ~= "string" then
error(fmt("user property '%s' value should be a string", name))
elseif ntype == "number" then
if type(val) ~= "table" or type(val[1]) ~= "string" or type(val[2]) ~= "string" then
error(fmt("user property at index %d should be a table with two strings", name))
elseif ntype == "number" then
if type(val) ~= "table" or type(val[1]) ~= "string" or type(val[2]) ~= "string" then
error(fmt("user property at index %d should be a table with two strings", name))
elseif ntype == "number" then
if type(val) ~= "table" or type(val[1]) ~= "string" or type(val[2]) ~= "string" then
error(fmt("user property at index %d should be a table with two strings", name))
-- and append it to props
if type(props) == "string" then
props = combine(prop)
-- check args
assert(type(args.id) == "string", "expecting .id to be a string with MQTT client id")
-- DOC: 3.1.2.10 Keep Alive
if args.keep_alive then
assert(type(args.keep_alive) == "number")
keep_alive_ival = args.keep_alive
-- DOC: 3.1.3.3 Will Topic
assert(type(args.will.topic) == "string", "expecting will.topic to be a string")
payload:append(make_string(args.will.topic))
-- DOC: 3.1.3.4 Will Payload
assert(args.will.payload == nil or type(args.will.payload) == "string", "expecting will.payload to be a string or nil")
payload:append(make_string(args.will.payload))
-- check args
assert(type(args.topic) == "string", "expecting .topic to be a string")
if args.payload ~= nil then
if args.payload ~= nil then
assert(type(args.payload) == "string", "expecting .payload to be a string")
end
if args.qos ~= nil then
assert(type(args.qos) == "number", "expecting .qos to be a number")
assert(check_qos(args.qos), "expecting .qos to be a valid QoS value")
if args.retain ~= nil then
assert(type(args.retain) == "boolean", "expecting .retain to be a boolean")
end
if args.dup ~= nil then
assert(type(args.dup) == "boolean", "expecting .dup to be a boolean")
end
if args.qos and args.qos > 0 then
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.rc) == "number", "expecting .rc to be a number")
-- DOC: 3.4.2 PUBACK Variable Header
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.rc) == "number", "expecting .rc to be a number")
-- DOC: 3.5.2 PUBREC Variable Header
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.rc) == "number", "expecting .rc to be a number")
-- DOC: 3.6.2 PUBREL Variable Header
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.rc) == "number", "expecting .rc to be a number")
-- DOC: 3.7.2 PUBCOMP Variable Header
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.subscriptions) == "table", "expecting .subscriptions to be a table")
assert(#args.subscriptions > 0, "expecting .subscriptions to be a non-empty array")
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "table", "expecting .subscriptions["..i.."] to be a table")
assert(type(subscription.topic) == "string", "expecting .subscriptions["..i.."].topic to be a string")
assert(type(subscription) == "table", "expecting .subscriptions["..i.."] to be a table")
assert(type(subscription.topic) == "string", "expecting .subscriptions["..i.."].topic to be a string")
if subscription.qos ~= nil then -- TODO: maybe remove that check and make .qos mandatory?
if subscription.qos ~= nil then -- TODO: maybe remove that check and make .qos mandatory?
assert(type(subscription.qos) == "number", "expecting .subscriptions["..i.."].qos to be a number")
assert(check_qos(subscription.qos), "expecting .subscriptions["..i.."].qos to be a valid QoS value")
if subscription.retain_as_published ~= nil then
assert(type(subscription.retain_as_published) == "boolean", "expecting .subscriptions["..i.."].retain_as_published to be a boolean")
end
if subscription.retain_handling ~= nil then
assert(type(subscription.retain_handling) == "number", "expecting .subscriptions["..i.."].retain_handling to be a number")
assert(check_retain_handling(subscription.retain_handling), "expecting .subscriptions["..i.."].retain_handling to be a valid Retain Handling option")
-- check args
assert(type(args.packet_id) == "number", "expecting .packet_id to be a number")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(check_packet_id(args.packet_id), "expecting .packet_id to be a valid Packet Identifier")
assert(type(args.subscriptions) == "table", "expecting .subscriptions to be a table")
assert(#args.subscriptions > 0, "expecting .subscriptions to be a non-empty array")
for i, subscription in ipairs(args.subscriptions) do
assert(type(subscription) == "string", "expecting .subscriptions["..i.."] to be a string")
payload:append(make_string(subscription))
-- check args
assert(type(args.rc) == "number", "expecting .rc to be a number")
-- DOC: 3.14.2 DISCONNECT Variable Header
-- check args
assert(type(args.rc) == "number", "expecting .rc to be a number")
-- DOC: 3.15.2 AUTH Variable Header
function protocol5.make_packet(args)
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.type) == "number", "expecting .type number in args")
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.type) == "number", "expecting .type number in args")
local ptype = args.type
local function parse_properties(ptype, read_data, input, packet)
assert(type(read_data) == "function", "expecting read_data to be a function")
-- DOC: 2.2.2 Properties
@/lua/vehicle/controller/pneumatics/crossFlowValve.lua
sourceTankMinPressure = jbeamData.sourceTankMinPressure or 0
if type(jbeamData.sourceTankMinPressurePSI) == "number" then
sourceTankMinPressure = jbeamData.sourceTankMinPressurePSI * psiToPascal + 101325
pressureDiffForFullFlow = jbeamData.pressureDiffForFullFlow or 34473.8 -- Pascals; default = 5 PSI
if type(jbeamData.pressureDiffForFullFlowPSI) == "number" then
pressureDiffForFullFlow = jbeamData.pressureDiffForFullFlowPSI * psiToPascal -- This is a pressure delta; don't add atmospheric pressure!
@/lua/ge/extensions/core/trafficSignals.lua
local function setControllerDefinitions(data) -- sets custom controller states and types (e.g. custom traffic light phase)
if type(data) == 'table' then
tableMerge(controllerDefinitions.states, data.states or {})
for i, v in ipairs(e) do
if type(v.id) == 'number' then
_uid = math.max(_uid, v.id)
@/lua/ge/extensions/scenario/scenariosLoader.lua
for i, v in ipairs(scenarioData.BranchLapConfig) do
if type(v) == 'string' then
table.insert(scenarioData.lapConfig, v)
-- jsonReadFile for valid scenarios returns a table with 1 entry
if type(scenarioData) == 'table' and #scenarioData == 1 then
processedScenario = processScenarioData(key, scenarioData[1], scenarioPath)
local fgPath = sc.flowgraph
if type(sc.flowgraph) ~= 'string' then
fgPath = sc.scenarioName .. '.flow.json'
if levelInfo and levelInfo.levelInfo and type(levelInfo.levelInfo.previews) == 'table' and #levelInfo.levelInfo.previews > 0 then
-- add prefix
@/lua/ge/extensions/gameplay/traffic.lua
if reset then resetTrafficVars() end
if type(data) ~= 'table' then return end
if k == 'aiMode' or k == 'aiDebug' or k == 'aiAware' then
data[k] = type(v) == 'string' and string.lower(v) or v
end
local function activate(vehList, ignoreFilter) -- activates traffic mode, and adds specified vehicles to the traffic table
if type(vehList) ~= 'table' then -- for backwards compatibility
vehList = {}
for _, id in ipairs(vehList) do
if type(id) == 'number' then
map.request(id, -1) -- force mapmgr to read map (performance optimization)
groupData = groupData or core_multiSpawn.createGroup(amount)
options = type(options) == 'table' and options or {}
state = 'spawning'
policeRatio = policeRatio or 0 -- can be between 0 and 1
options = type(options) == 'table' and options or {}
if type(options.vehGroup) == 'table' then -- directly sets a vehicle group to be used for traffic; may overwrite other parameters
trafficGroup = options.vehGroup
local function setupCustomTraffic(amount, params) -- spawns a group of vehicles for traffic, with custom parameters
if type(params) ~= 'table' then params = {} end
if not amount or amount < 0 then amount = getAmountFromSettings() end
@/inspector/Views/DebuggerTabContentView.js
get type()
{
@/lua/ge/extensions/gameplay/missions/missionTypes/flowMission.lua
if type(self.setupModules.timeOfDay) == "number" then
self.setupModules.timeOfDay = {enabled = true, time = self.setupModules.timeOfDay}
log("D","","Setting Mission Variable: " .. name .. " --> " .. dumps(value))
local t = type(value)
if t == "boolean" then t = "bool"
@/lua/ge/extensions/flowgraph/nodes/states/transitionStack.lua
if not pins[name] then
pins[name] = type(pin.type) == 'string' and pin.type or 'any'
end
if not pins[name] then
pins[name] = type(pin.type) == 'string' and pin.type or 'any'
end
@/lua/common/libs/LuLPeg/lulpeg.lua
local fun
if type (ld) == 'string' then
fun = loadstring (ld)
str_indent = str_indent or 1
if "string" == type( v ) then
v = s_gsub( v, "\n", "\n" .. (" "):rep( indent * multiplier + str_indent ) )
end
elseif "cdata" == type( v ) then
cdata_to_str( v, acc, indent )
cdata_to_str( v, acc, indent )
elseif "table" == type(v) then
if t_cache[v] then
function key_to_str ( k, acc, indent )
if "string" == type( k ) and s_match( k, "^[_%a][_%a%d]*$" ) then
acc[#acc+1] = s_gsub( k, "\n", (" "):rep( indent * multiplier + 1 ) .. "\n" )
function util.map (ary, func, ...)
if type(ary) == "function" then ary, func = func, ary end
local res = {}
function util.selfmap (ary, func, ...)
if type(ary) == "function" then ary, func = func, ary end
for i = 1,#ary do
function map_all (tbl, func, ...)
if type(tbl) == "function" then tbl, func = func, tbl end
local res = {}
.."' (string expected, got "
..type(s)
..")",
if i == 0 or i == 1 or i == nil then return 1
elseif type(i) ~= "number" then error"number or nil expected for the stating index"
elseif i > 0 then return i > len and len + 1 or i
pt = LL_P(pt)
assert(type(sbj) == "string", "string expected for the match subject")
si = computeidex(si, #sbj)
if final_si == true then final_si = Cmt_si end
if type(final_si) == "number"
and si <= final_si
end
elseif type(final_si) == "number" then
error"Index out of bounds returned by match-time capture."
function byteset_new (t)
if type(t) == "number" then
local res = boolset_constructor(t+1)
end
function isboolset(s) return type(s)=="cdata" and ffi.istype(s, boolset_constructor) end
isbyteset = isboolset
function byteset_new (t)
if type(t) == "number" then return byteset_constructor(t) end
local set = byteset_constructor(u_max(t))
function set_if_not_yet (s, dest)
if type(s) == "number" then
dest[s] = true
local upper = m_max(
type(a) == "number" and a or #a,
type(b) == "number" and b or #b
type(a) == "number" and a or #a,
type(b) == "number" and b or #b
)
function set_union (a, b)
a, b = (type(a) == "number") and set_new{a} or a
, (type(b) == "number") and set_new{b} or b
a, b = (type(a) == "number") and set_new{a} or a
, (type(b) == "number") and set_new{b} or b
local res = set_new{}
local list = {}
a, b = (type(a) == "number") and set_new{a} or a
, (type(b) == "number") and set_new{b} or b
a, b = (type(a) == "number") and set_new{a} or a
, (type(b) == "number") and set_new{b} or b
for el in pairs(a) do
local cs = (Builder.options or {}).charset or "binary"
if type(cs) == "string" then
cs = (cs == "binary") and "binary" or "other"
local function equalcap (s, i, c)
if type(c) ~= "string" then return nil end
local e = #c + i
local function compile (p, defs)
if mm.type(p) == "pattern" then return p end -- already compiled
local cp = pattern:match(p, 1, defs)
until ci == 1
label = type(label) == "string" and "'"..label.."'" or tostring(label)
error("back reference "..label.." not found")
"V( ",
(type(pt.aux) == "string" and "\""..pt.aux.."\"")
or tostring(pt.aux)
for k, pt in pairs(pt.aux) do
local prefix = ( type(k)~="string"
and tostring(k)
caps.aux[ci] and (
type(caps.aux[ci]) == "string"
and '"'..tostring(caps.aux[ci])..'"'
}))
if type(caps.aux[ci]) == "table" then expose(caps.aux[ci]) end
else
caps.aux[ci] and (
type(caps.aux[ci]) == "string"
and '"'..tostring(caps.aux[ci])..'"'
if n == 0 then error"bad argument #1 to 'P' (value expected)" end
local typ = type(v)
if LL_ispattern(v) then
success, n = pcall(tonumber, n)
assert(success and type(n) == "number",
"Invalid type encountered at right side of '^'.")
LL["Carg"] = function(aux)
assert(type(aux)=="number", "Number expected as parameter to Carg capture.")
assert( 0 < aux and aux <= 200, "Argument out of bounds in Carg capture.")
LL[cap] = function(pt, aux)
assert(type(aux) == "function", msg)
pt = LL_P(pt)
error"The right side of a '/' capture cannot be a pattern."
elseif not valid_slash_type[type(aux)] then
error("The right side of a '/' capture must be of type "
else
name = "div_"..type(aux)
end
LL.ispattern = LL_ispattern
function LL.type(pt)
if LL_ispattern(pt) then
local prox2 = newproxy(prox)
assert (type(getmetatable(prox)) == "table"
and (getmetatable(prox)) == (getmetatable(prox2)))
@/inspector/Models/DOMBreakpoint.js
get type() { return this._type; }
get url() { return this._url; }
@/lua/ge/extensions/editor/api/preferencesRegistry.lua
-- if the item value is a string, then we've already have an encoded json
if type(itemVal) == "string" then return itemVal end
itemVal = jsonEncode(itemVal)
if not subcat then return nil end
if type(subcat) ~= "table" then return nil end
for _, item in ipairs(subcat.items) do
for catName, cat in pairs(self.preferences) do
if type(cat) ~= "table" then
editor.logWarn("Preferences category " .. catName .. " is invalid, not a table, ignoring, using defaults")
for subcatName, subcat in pairs(cat) do
if type(subcat) ~= "table" then
editor.logWarn("Preferences subcategory " .. catName .. "." .. subcatName .. " is invalid, not a table, ignoring, using defaults")
if not item then return editor.logError("No registered preference: " .. itemPath) end
if item and type(value) == "number" then
value = clamp(value, item.minValue or -math.huge, item.maxValue or math.huge)
isDefaultValue = true
elseif type(self.preferences[cat.name]) ~= "table" then
-- skip, category should be a table
isDefaultValue = true
elseif type(self.preferences[cat.name][subCat.name]) ~= "table" then
-- skip, subcategory should be a table
-- so check if its not a table (the new version of prefs are tables)
isOldValue = type(val) ~= "table" and not isDefaultValue
-- check if the value is an old preference string value we need to convert to a table with type and version
@/lua/vehicle/powertrain.lua
device.uiSimpleModeControl = jbeamData.uiSimpleModeControl == nil and true or jbeamData.uiSimpleModeControl
if type(jbeamData.visualPositionRelativeParent) == "table" and tableSize(jbeamData.visualPositionRelativeParent) == 3 then
device.visualPositionRelativeParent = {
end
if type(jbeamData.visualPositionRelativeChildren) == "table" and tableSize(jbeamData.visualPositionRelativeChildren) > 0 then
for _, childRelativePosition in pairs(jbeamData.visualPositionRelativeChildren) do
if device.breakTriggerBeam then
if type(device.breakTriggerBeam) ~= "table" then
device.breakTriggerBeam = {device.breakTriggerBeam}
local splits = split(k, delim)
if type(v) == "table" then
local groupType = splits[2] or "main" --if no groupType is specified, use "main", this means that these are equivalent: "deformGroups": [] and "deformGroups_main":[]
if device and device.setPartCondition then
if type(integrity) == "table" then
deviceIntegrity = integrity.powertrain[device.name]
@/lua/vehicle/powertrain/linearActuator.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/ge/extensions/util/procTrack.lua
size = {0.33, 0.33, 1}
elseif type(size) ~= "table" then
size = {0.33, 0.33, size}
@/inspector/Views/SettingEditor.js
get element() { return this._element; }
get type() { return this._type; }
@/lua/ge/extensions/gameplay/statistic.lua
local l = jsonReadFile(fileName)
if l and l.entries and type(l.entries)=="table" and l.version then
fileData = l
if im.BeginTabItem("entries career") then
--im.TextUnformatted("save : "..dumps(type(fileNameCareer))..dumps(string.len(fileNameCareer or "") )..dumps(fileNameCareer))
if fileDataCareer then
-- if no stats are found, create empty data.
if not fileDataCareer or not fileDataCareer.entries or type(fileDataCareer.entries)~="table" or not fileDataCareer.version then
fileDataCareer = {version=1, entries={}}
@/lua/ge/extensions/core/settings/graphicsQualityGroup.lua
function C:apply(qualityLevel)
if type(qualityLevel) == 'table' then
local changeDetected = false
@/lua/vehicle/powertrain/combustionEngineThermals.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
for _, n in pairs(v.data.nodes) do
if n.isExhaust and (type(n.isExhaust) == "boolean" or n.isExhaust == parentEngine.name) then
table.insert(exhaustStartNodes, n)
for _, b in pairs(v.data.beams) do
if b.isExhaust and (type(b.isExhaust) == "boolean" or b.isExhaust == parentEngine.name) then
--one table for immediate use
@/lua/common/libs/luasec/https.lua
for name, method in pairs(mt) do
if type(method) == "function" then
conn[name] = function (self, ...)
local result_table = {}
local stringrequest = type(url) == "string"
if stringrequest then
@/lua/common/libs/LuaIRC/util.lua
setmetatable(color, {__call = function(_, text, colornum)
colornum = type(colornum) == "string" and assert(color[colornum], "Invalid color '"..colornum.."'") or colornum
return table.concat{colByte, tostring(colornum), text, colByte}
@/inspector/External/CodeMirror/codemirror.js
// W2. Search backwards from each instance of a European number
// until the first strong type (R, L, AL, or sor) is found. If an
// AL is found, change the type of the European number to Arabic
// W7. Search backwards from each instance of a European number
// until the first strong type (R, L, or sor) is found. If an L is
// found, then change the type of the European number to L.
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/vePartTree.lua
local function _clearNodeSelection(node)
if type(node) == 'table' then
node.__selected = nil
local function _selectAndHighlightNode(node)
if type(node) == 'table' then
node.__selected = true
local function _deselectAndUnhighlightNode(node)
if type(node) == 'table' then
node.__selected = nil
local function _selectNode(node)
if type(node) == 'table' then
node.__selected = true
local function _setNodeHidden(node, hidden)
if type(node) == 'table' then
node.__hidden = hidden
if type(part.nodes) == 'table' then
local node = part.nodes[nodeId]
if node then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
node.pos = vec3(node.posX, node.posY, node.posZ)
if node then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
node.pos = vec3(node.posX, node.posY, node.posZ)
if node then
if type(node.posX) == 'number' and type(node.posY) == 'number' and type(node.posZ) == 'number' then
node.pos = vec3(node.posX, node.posY, node.posZ)
local label = _nodeLabel or tostring(node)
if type(node) == 'table' then
local flags = 0 -- im.TreeNodeFlags_SpanFullWidth
if k ~= '__astNodeIdx' and k ~= '__selected' and k ~= '__hidden' and k ~= 'maxIDs' and k ~= 'validTables' and k ~= '__schemaProcessed' then
if type(v) == 'table' then
im.TableNextRow()
for _, node in pairs(part.nodes) do
if type(node) == 'table' and node.pos ~= nil then
local nodeCID = node.cid
for key, beam in pairs(part.beams) do
if type(beam) == 'table' then
local id = beam['id1:'] .. beam['id2:']
local part = ast.transient.luaData[vEditor.selectedPart]
if type(part) == 'table' and type(part.nodes) == 'table' then
local hitNodes = renderPickTransformNodes(part, imguiNotHovered, rayDir, rayStartPos, rayEndPos)
local part = ast.transient.luaData[vEditor.selectedPart]
if type(part) == 'table' and type(part.nodes) == 'table' then
local hitNodes = renderPickTransformNodes(part, imguiNotHovered, rayDir, rayStartPos, rayEndPos)
if type(part.beams) == 'table' then
renderPickTransformBeams(hitNodes, part, imguiNotHovered, rayDir, rayStartPos, rayEndPos)
@/lua/common/extensions.lua
else
if type(loader) == 'function' then
return true
if type(extNames) ~= 'table' then
extNames = {extNames}
if type(m.onExtensionUnloaded) == 'function' then
m.onExtensionUnloaded()
m.onExtensionUnloaded()
elseif type(m.onUnload) == 'function' then
log('W', logTag, "Lua extension '".. extName.."' uses deprecated 'onUnload()' method, please use 'onExtensionUnloaded()' instead")
if type(extName) == "table" and type(extName.__extensionName__) == "string" then
extName = extName.__extensionName__
if type(extName) == "table" and type(extName.__extensionName__) == "string" then
extName = extName.__extensionName__
if type(m) ~= "table" and type(m) ~= "function" then
log('I', logTag, "Lua extension invalid: " .. extPath .. '. Does it return M? It returned this: ' .. tostring(m))
if type(m) ~= "table" and type(m) ~= "function" then
log('I', logTag, "Lua extension invalid: " .. extPath .. '. Does it return M? It returned this: ' .. tostring(m))
if type(m) == "table" then
-- check for deprecated functions being used in this module
for name,data in pairs(deprecatedExtensions) do
if type(m[name]) == 'function' then
log('W', logTag, "Lua extension '".. extPath.."' uses deprecated '" ..name.."()' function, please use '"..data.replacement.."()' instead")
-- allow the module to refuse loading
if loadedFresh and (type(m.onExtensionLoaded)=='function' or type(m.onInit)=='function') then
table.insert(loadedFreshModules, m.__extensionName__)
-- allow the module to refuse loading
if loadedFresh and (type(m.onExtensionLoaded)=='function' or type(m.onInit)=='function') then
table.insert(loadedFreshModules, m.__extensionName__)
for name, value in pairs(m) do
if type(value) == "function" and name ~= "wrapAllExtensions" then
m[name] = wrapFunctionWithProfiler(value, m.__extensionName__ .. "." .. name)
for k, v in pairs(m) do
if type(v) == 'function' then
local d = debug.getinfo(v)
m = require(extPath)
if type(m) ~= 'table' then
log('E', 'logtag', 'Module does not return the module exports M. is "return M" missing at the end of the file? Extension unavailable: ' .. dumps(extName)..' at location: '..dumps(extPath))
for memberName, member in pairs(m) do
if type(member) == "function" then
m[memberName] = wrapFunctionWithProfiler(member, extName .. "." .. memberName)
for _,entry in ipairs({...}) do
if type(entry) == 'string' then
table.insert(moduleDataArray, entry)
for _, v in ipairs(entry) do
if type(v) == 'string' then
table.insert(moduleDataArray, v)
local m = rawget(_G, moduleName)
if m and type(m.onInit) == 'function' then
-- log('I','',' '..m.__extensionName__..'.onInit('..dumps(deserializedData[m.__extensionName__])..')')
if type(excludeSubdirectories) == 'table' then
local processed = {}
for _, m in ipairs(resolvedModules) do
if type(m) == "table" then
local func = m[funcName]
local func = m[funcName]
if func ~= nop and type(func) == 'function' then
local extCallName = "extensions."..m.__extensionName__..'.'..funcName
local func = m[funcName]
if func ~= nop and type(func) == 'function' then
local funcInfo = {func = func, extCallName = m.__extensionName__..'.'..funcName}
for _, m in ipairs(resolvedModules) do
if type(m) == "table" then
local func = m[funcName]
local func = m[funcName]
if func ~= nop and type(func) == 'function' then
local extCallName = "extensions."..m.__extensionName__..'.'..funcName
local func = m[funcName]
if func ~= nop and type(func) == 'function' then
table.insert(hookFuncs, func)
for _, m in ipairs(resolvedModules) do
if type(m) == "table" then
local func = m[funcName]
local func = m[funcName]
if func ~= nop and type(func) == 'function' then
print(m.__extensionName__..'.'..funcName)
if not exceptionDict[m.__extensionsModulePath__] then
if m[func] and type(m[func]) == 'function' then
m[func](...)
for _,entry in ipairs({...}) do
if type(entry) == 'string' then
table.insert(doNotSerializeModules, entry)
for _, v in ipairs(entry) do
if type(v) == 'string' then
table.insert(doNotSerializeModules, v)
local k = v.__extensionName__
if type(v) == 'table' and v.__virtual__ ~= true and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil or v['onSerialize'] ~= nil) then
if type(v['onSerialize']) == 'function' then
if type(v) == 'table' and v.__virtual__ ~= true and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil or v['onSerialize'] ~= nil) then
if type(v['onSerialize']) == 'function' then
-- if serialization function is existing, use that
--print("k="..tostring(k) .. " = " .. tostring(v))
if (filter == nil or k == filter) and type(v) == 'table' and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil) and data[k] ~= nil then
if type(v['onDeserialize']) == 'function' then
if (filter == nil or k == filter) and type(v) == 'table' and (v['onDeserialized'] ~= nil or v['onDeserialize'] ~= nil) and data[k] ~= nil then
if type(v['onDeserialize']) == 'function' then
-- having a deserilization function? then use that!
end
if type(v['onDeserialized']) == 'function' then
v['onDeserialized'](data[k])
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/campaign/dealer.lua
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function addToStock(itemType, valueObj)
log('I', logTag, 'addToStock called... itemType '..tostring(itemType)..' '..type(valueObj))
local state = M.state
local valueObjType = type(valueObj)
local function removeFromStock(itemType, valueObj)
log('I', logTag, 'removeFromStock called... itemType '..tostring(itemType)..' '..type(valueObj))
-- dump(state.stock)
local state = M.state
local valueObjType = type(valueObj)
itemType = string.upper(itemType)
@/lua/ge/extensions/gameplay/traffic/baseRole.lua
-- this always gets called when the vehicle respawns, unless self.keepPersonalityOnRefresh is true
if type(data) ~= 'table' then
self.driver.personality = deepcopy(basePersonality)
@/lua/common/libs/slaxml/slaxdom.lua
local out = {}
local tab = opts.indent and (type(opts.indent)=="number" and string.rep(" ",opts.indent) or opts.indent) or ""
local ser = {}
@/lua/ge/extensions/ui/gameplaySelector/general.lua
if type(propVal) == "table" then
for _, val in pairs(propVal) do
local propVal = item[propName:lower()] or item[propName]
if type(propVal) == 'string' then
if string.find(string.lower(propVal), searchTextLower, 1, true) then
if filter.type == 'range' then
if propVal == "Other..." or not type(propVal) == 'number' then
return false
@/lua/ge/extensions/flowgraph/manager.lua
elseif not self.graph:pinsCompatible(startPin, endPin) then
if (startPin.type == "table" or (type(startPin.type) == "table" and tableContains(startPin.type, "table")))
and (endPin.type == "table" or (type(endPin.type) == "table" and tableContains(endPin.type, "table")))
if (startPin.type == "table" or (type(startPin.type) == "table" and tableContains(startPin.type, "table")))
and (endPin.type == "table" or (type(endPin.type) == "table" and tableContains(endPin.type, "table")))
and (startPin:getTableType() ~= endPin:getTableType() and startPin:getTableType() ~= 'generic' and endPin:getTableType() ~= 'generic') then
local paths = p
if type(p) == 'string' then
paths = { p }
local folders = {''}
if self.activity and self.activity.layers and type(self.activity.layers) == "table" then
for _, layer in ipairs(self.activity.layers) do
@/lua/ge/extensions/telemetry/core.lua
-- Validate event parameter
if not event or type(event) ~= "table" then
log('E', 'telemetry', "addEvent: event parameter is required and must be a table" .. (event and " (got " .. type(event) .. ")" or ""))
if not event or type(event) ~= "table" then
log('E', 'telemetry', "addEvent: event parameter is required and must be a table" .. (event and " (got " .. type(event) .. ")" or ""))
return
-- Check for required name field
if not event.name or type(event.name) ~= "string" or event.name == "" then
log('E', 'telemetry', "addEvent: event.name is required and must be a non-empty string" .. (event.name and " (got " .. type(event.name) .. ")" or ""))
if not event.name or type(event.name) ~= "string" or event.name == "" then
log('E', 'telemetry', "addEvent: event.name is required and must be a non-empty string" .. (event.name and " (got " .. type(event.name) .. ")" or ""))
return
@/lua/vehicle/energyStorage.lua
if device.energyStorage then
if device.energyStorage and type(device.energyStorage) ~= "table" then
device.energyStorage = {device.energyStorage}
if storage.breakTriggerBeam then
if type(storage.breakTriggerBeam) ~= "table" then
storage.breakTriggerBeam = {storage.breakTriggerBeam}
if device.energyStorage then
if device.energyStorage and type(device.energyStorage) ~= "table" then
device.energyStorage = {device.energyStorage}
if storage and storage.setPartCondition then
if type(integrity) == "table" and integrity.energyStorage then
storageIntegrity = integrity.energyStorage[storage.name]
local function onDeserialize(data)
-- if not data or type(data) ~= "table" then
-- return
@/lua/ge/extensions/util/trackBuilder/materialUtil.lua
local function toBool(val)
if type(val) == "string" then
if val == "0" then return false elseif val == "1" then return true end
if val == "0" then return false elseif val == "1" then return true end
elseif type(val) == "number" then
if val == 0 then return false elseif val == 1 then return true end
else
log('E', logTag, "Type " .. type(val) .. " not supported by toBool() function!")
end
for key, value in pairs(material) do
if type(material[key]) == "table" then
local same = true
if material[key] == nil then
if type(original[key]) == "table" then
material[key] = {original[key][1],original[key][2],original[key][3],original[key][4]}
@/lua/ge/extensions/tech/techCore.lua
for _, triangle in pairs(debugObjects.triangles) do
if type(triangle.color) == "number" then
debugDrawer:drawTriSolid(triangle.a, triangle.b, triangle.c, triangle.color)
local timeOfDay = core_environment.getTimeOfDay()
local todIsNumber = type(request['time']) == 'number'
@/lua/ge/extensions/ui/freeroamSelector/general.lua
if type(propVal) == "table" then
for _, val in pairs(propVal) do
local propVal = item[propName:lower()] or item[propName]
if type(propVal) == 'string' then
if string.find(string.lower(propVal), searchTextLower, 1, true) then
if filter.type == 'range' then
if propVal == "Other..." or not type(propVal) == 'number' then
return false
@/lua/ge/extensions/flowgraph/nodes/vehicle/special/customVehicleGetter.lua
if type(self.returnedValue) == 'number' then
self.pinOut.valBool.value = self.returnedValue ~= 0
@/inspector/Views/SettingsTabContentView.js
get type() { return WI.SettingsTabContentView.Type; }
@/lua/vehicle/controller.lua
local controller = rerequire(filePath)
if controller and type(controller) == "table" then
local data = tableMergeRecursive(c, v.data[k] or {})
local function onDeserialize(data)
if not data or type(data) ~= "table" then
return
@/lua/common/extensions/ui/imguiUtils.lua
for k,v in pairs(tbl) do
if type(v) ~= 'table' then
imgui.TextUnformatted(tostring(k) .. ' :')
local function itemCallback(begin, fullpath, k, val)
if type(val) ~= 'table' then return end
if begin then
for _, tv in pairs(t) do
if type(tv) == 'table' then
tableType = tableType + 1
local _, level = string.gsub(fullpath, "%/", "")
if type(data) == 'table' then
local tsize = tableSize(data)
elseif type(data) == 'boolean' then
if data then
elseif type(data) == 'number' then
imgui.PushStyleColor2(imgui.Col_Text, imgui.ImVec4(0.7, 0.7, 1, 1))
elseif type(data) == 'string' then
if string.len(data) == 0 then
elseif type(data) == 'userdata' then
-- implement some LuaIntF types
end
elseif type(data) == 'function' then
imgui.PushStyleColor2(imgui.Col_Text, imgui.ImVec4(0.7, 0.6, 0.4, 1))
@/lua/ge/extensions/editor/slotTrafficEditor.lua
local function isSelected(item)
if type(item) == "table" then
-- item is a link
@/lua/vehicle/powertrain/torsionReactor.lua
for _, v in pairs(jbeamData.torqueReactionNodes_nodes or {}) do
if type(v) == "number" then
table.insert(device.torqueReactionNodes, v)
@/lua/ge/extensions/flowgraph/nodes/activity/autoStarGoals.lua
for key, value in pairs(data) do
if type(value) == 'string' or type(value) == 'number' then
context[key] = tostring(value)
for key, value in pairs(data) do
if type(value) == 'string' or type(value) == 'number' then
context[key] = tostring(value)
local label = self.mgr.activity.starLabels[star] or "Missing Star Description"
if type(label) == "string" then
label = {
}
elseif type(label) == "function" then
label = label(self.mgr.activity)
@/lua/ge/extensions/career/modules/reputation.lua
if levelInfo[attributeKey] then
if type(levelInfo[attributeKey]) == "table" then
for key, value in pairs(attributeValue) do
@/lua/ge/extensions/editor/veMain.lua
if ext and ext.menuEntry and type(ext.open) == "function" and type(ext.menuEntry) == "string" then
entries[ext.menuEntry] = ext.open
if ext and ext.menuEntry and type(ext.open) == "function" and type(ext.menuEntry) == "string" then
entries[ext.menuEntry] = ext.open
if ext and ext.menuEntry and type(ext.open) == "function" and type(ext.menuEntry) == "string" then
entries[ext.menuEntry] = ext.open
if ext and ext.menuEntry and type(ext.open) == "function" and type(ext.menuEntry) == "string" then
entries[ext.menuEntry] = ext.open
@/lua/vehicle/beamstate.lua
local function setPartCondition(partId, partTypeData, odometer, integrity, visual)
if type(integrity) == "number" then
local integrityValue = integrity
if type(visual) == "number" then
visual = {
if deformGroup then
if type(deformGroup) == "table" then
for _, g in ipairs(deformGroup) do
local forwardToCouplingsExtension = true
if type(_nodetag) == "string" then
nodeTags = {[_nodetag] = true}
forwardToCouplingsExtension = false
elseif type(_nodetag) == "table" then
nodeTags = {}
local breakGroups = type(n.breakGroup) == "table" and n.breakGroup or {n.breakGroup}
for _, g in pairs(breakGroups) do
if n.breakGroup and (n.breakGroupType == 0 or n.breakGroupType == nil) then
if type(n.breakGroup) ~= "table" and couplerBreakGroupCache[n.breakGroup] == nil then
-- shortcircuit in case of broken single breakGroup
else
local breakGroups = type(n.breakGroup) == "table" and n.breakGroup or {n.breakGroup}
for _, g in pairs(breakGroups) do
if torsionbar.breakGroup then
if type(torsionbar.breakGroup) ~= "table" and breakGroupCache[torsionbar.breakGroup] == nil then
-- shortcircuit in case of broken single breakGroup
else
local breakGroups = type(torsionbar.breakGroup) == "table" and torsionbar.breakGroup or {torsionbar.breakGroup}
for _, g in ipairs(breakGroups) do
if beam.breakGroup then
if type(beam.breakGroup) ~= "table" and breakGroupCache[beam.breakGroup] == nil then
-- shortcircuit in case of broken single breakGroup
else
local breakGroups = type(beam.breakGroup) == "table" and beam.breakGroup or {beam.breakGroup}
for _, g in ipairs(breakGroups) do
local b1, b2 = beam.id1, beam.id2
if type(b1) == "number" and type(b2) == "number" then
beamIndex[min(b1, b2) + max(b1, b2) * 1e+8] = beam
local b1, b2 = beam.id1, beam.id2
if type(b1) == "number" and type(b2) == "number" then
beamIndex[min(b1, b2) + max(b1, b2) * 1e+8] = beam
local t1, t2, t3 = tri.id1, tri.id2, tri.id3
if type(t1) == "number" and type(t2) == "number" and type(t3) == "number" then
local beamCount = 0
local t1, t2, t3 = tri.id1, tri.id2, tri.id3
if type(t1) == "number" and type(t2) == "number" and type(t3) == "number" then
local beamCount = 0
local t1, t2, t3 = tri.id1, tri.id2, tri.id3
if type(t1) == "number" and type(t2) == "number" and type(t3) == "number" then
local beamCount = 0
if t.breakGroup then
local breakGroups = type(t.breakGroup) == "table" and t.breakGroup or {t.breakGroup}
for _, g in pairs(breakGroups) do
if n.breakGroup then
local breakGroups = type(n.breakGroup) == "table" and n.breakGroup or {n.breakGroup}
for _, g in pairs(breakGroups) do
if b.tag then
if type(b.tag) == "string" then
M.tagBeamMap[b.tag] = M.tagBeamMap[b.tag] or {}
table.insert(M.tagBeamMap[b.tag], bid)
elseif type(b.tag) == "table" then
for _, tag in b.tag do
if b.linkTag then
if type(b.linkTag) == "string" then
M.linkTagBeamMap[b.linkTag] = M.linkTagBeamMap[b.linkTag] or {}
table.insert(M.linkTagBeamMap[b.linkTag], bid)
elseif type(b.tag) == "table" then
for _, tag in b.linkTag do
if b.breakGroup then
local breakGroups = type(b.breakGroup) == "table" and b.breakGroup or {b.breakGroup}
for _, g in pairs(breakGroups) do
if b.deformGroup then
local deformGroups = type(b.deformGroup) == "table" and b.deformGroup or {b.deformGroup}
for _, g in pairs(deformGroups) do
if type(b.beamPrecompressionTime) == "number" and b.beamPrecompressionTime > 0 then
delayedPrecompBeams = delayedPrecompBeams or {}
for _, t in pairs(v.data.torsionbars) do
if type(t.precompressionTime) == "number" and t.precompressionTime > 0 then
delayedPrecompTorsionbar = delayedPrecompTorsionbar or {}
if deformGroup then
if type(deformGroup) == "table" then
for _, g in ipairs(deformGroup) do
if b.breakGroup ~= nil then
local breakGroups = type(b.breakGroup) == "table" and b.breakGroup or {b.breakGroup}
-- multiple break groups
for _, g in pairs(breakGroups) do
if type(g) == "string" and (string.find(g, "hinge") ~= nil or string.find(g, "latch") ~= nil) then
--log('D', "beamstate.breakHinges"," breaking hinge beam "..k.. " as in breakgroup ".. b.breakGroup)
for breakgroup, _ in pairs(couplerBreakGroupCache) do
if type(breakgroup) == "string" and (string.find(breakgroup, "hinge") ~= nil or string.find(breakgroup, "latch") ~= nil) then
breakBreakGroup(breakgroup)
if b.deformSwitches ~= nil then
local deformSwitchesT = type(b.deformSwitches) == "table" and b.deformSwitches or {b.deformSwitches}
for _, g in pairs(deformSwitchesT) do
@/lua/vehicle/powertrain/nitrousOxideInjection.lua
local cid2 = valveNodes[i + 1]
if type(cid1) == "number" and type(cid2) == "number" then
table.insert(purgeValveNodes, {cid1 = cid1, cid2 = cid2})
local cid2 = valveNodes[i + 1]
if type(cid1) == "number" and type(cid2) == "number" then
table.insert(purgeValveNodes, {cid1 = cid1, cid2 = cid2})
for k, _ in pairs(assignedEngine.torqueCurve) do
if type(k) == "number" and k < assignedEngine.maxRPM then
local rpm = floor(k)
@/lua/ge/extensions/core/flowgraphManager.lua
for _, pin in ipairs(node.pinSchema) do
if type(pin.type) == 'table' then -- because multiple types per pin are possible
for i = 1, #pin.type do
@/lua/ge/extensions/gameplay/rally/driveline/drivelineRoute.lua
local function valToStr(v)
if type(v) == "table" then
return "{" .. tableToOneLineString(v) .. "}"
return "{" .. tableToOneLineString(v) .. "}"
elseif type(v) == "string" then
return "'" .. v .. "'"
return "'" .. v .. "'"
elseif type(v) == "number" then
local fmt = v % 1 == 0 and "%d" or "%.5f"
return string.format(fmt, v)
elseif type(v) == "boolean" then
return v and 'T' or 'F'
for k,v in pairs(point.metadata) do
if type(v) == "table" then
if k == "wpCs" or k == "wpCe" then
@/gameplay/missionTypes/drift/customNodes/updateTaskListObjectivesNode.lua
for key, value in pairs(data) do
if type(value) == 'string' or type(value) == 'number' then
context[key] = tostring(value)
for key, value in pairs(data) do
if type(value) == 'string' or type(value) == 'number' then
context[key] = tostring(value)
local label = self.mgr.activity.starLabels[key] or "Missing Star Description"
if type(label) == "string" then
label = {
local label = self.mgr.activity.starLabels["combo"] or "Missing Star Description"
if type(label) == "string" then
label = {
@/lua/vehicle/powertrain/combustionEngine.lua
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurve[k + 1] = v - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveNitrous[k + 1] = v + (nitrousTorques[k] or 0) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveTurbo[k + 1] = (v * (turboCoefs[k] or 0)) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveSupercharger[k + 1] = (v * (superchargerCoefs[k] or 0)) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveFinal[k + 1] = (v * (turboCoefs[k] or 0) * (superchargerCoefs[k] or 0)) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveFinal[k + 1] = (v * (turboCoefs[k] or 0) + (nitrousTorques[k] or 0)) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveFinal[k + 1] = (v * (superchargerCoefs[k] or 0) + (nitrousTorques[k] or 0)) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" and k < maxRPM then
torqueCurveFinal[k + 1] = (v * (turboCoefs[k] or 0) * (superchargerCoefs[k] or 0) + (nitrousTorques[k] or 0)) - device.friction * device.wearFrictionCoef * device.damageFrictionCoef - (device.dynamicFriction * device.wearDynamicFrictionCoef * device.damageDynamicFrictionCoef * k * rpmToAV)
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
local torqueReactionNodes_nodes = jbeamData.torqueReactionNodes_nodes
if torqueReactionNodes_nodes and type(torqueReactionNodes_nodes) == "table" then
local hasValidReactioNodes = true
for _, v in pairs(torqueReactionNodes_nodes) do
if type(v) ~= "number" then
hasValidReactioNodes = false
device.canFlood = device.waterDamageNodes and type(device.waterDamageNodes) == "table" and #device.waterDamageNodes > 0
local tempBurnEfficiencyTable = nil
if not jbeamData.burnEfficiency or type(jbeamData.burnEfficiency) == "number" then
tempBurnEfficiencyTable = {{0, jbeamData.burnEfficiency or 1}, {1, jbeamData.burnEfficiency or 1}}
tempBurnEfficiencyTable = {{0, jbeamData.burnEfficiency or 1}, {1, jbeamData.burnEfficiency or 1}}
elseif type(jbeamData.burnEfficiency) == "table" then
tempBurnEfficiencyTable = deepcopy(jbeamData.burnEfficiency)
for k, v in pairs(copy) do
if type(k) == "number" then
table.insert(tempBurnEfficiencyTable, {v[1] * 100, v[2]})
@/lua/common/jbeam/sections/wheels.lua
if type(wheel.offsetFromNode) == "number" then
local halfHwidth = 0.5 * wheel.hubWidth * axis
if type(wheel.hubWeight) == "number" then
wheel.hubNodeWeight = wheel.hubWeight / (2 *wheel.numRays)
if type(wheel.tireWeight) == "number" then
wheel.nodeWeight = wheel.tireWeight / (2 * wheel.numRays)
if type(wheel.hubWeightGainRatio) == "number" and wheel.hubWeightGainRatio >= 0 and wheel.hubWeightGainRatio < 1 then
wheel.nodeWeight = wheel.nodeWeight * (1-wheel.hubWeightGainRatio)
local v = vehicle[wheelSection][k]
--log('D', "jbeam.processWheel"," * "..tostring(k).." = "..tostring(v).." ["..type(v).."]")
if v.numRays == nil or v.numRays > 0 then
local rotData = vehicle.rotators[rotId]
--log('D', "jbeam.postProcess"," * "..tostring(k).." = "..tostring(v).." ["..type(v).."]")
local wheelID = jbeamUtils.increaseMax(vehicle, 'wheels')
@/lua/vehicle/electricsCustomValueParser.lua
local index = 0
local selectorType = type(selector)
@/lua/common/libs/ezSVG/EzSVG.lua
local function serializableValue(k, v)
if type(v) == "function" then return false end
if type(k) == "number" then return true end
if type(v) == "function" then return false end
if type(k) == "number" then return true end
if string.sub(k, 1, k.len("__")) == "__" then return false end
if v ~= "" and v ~= nil then
if type(v) == "table" then
tbl[k] = v:__propertyValue(k, run)
tbl["setStyle"] = function(tbl, key, value)
if type(key) == "table" then
key = updashStyleTable(key)
tbl["mergeStyle"] = function(tbl, key, value)
if type(key) == "table" then
key = updashStyleTable(key)
function EzSVG.setStyle(key, value, tag)
if type(key) == "table" then
key = updashStyleTable(key)
end
elseif type(key) == "string" then
key = string.gsub(key, "_", "-")
ret["setText"] = function(tbl, text)
if type(text) == "number" then text = tostring(text) end
if type(text) == "string" then
if type(text) == "number" then text = tostring(text) end
if type(text) == "string" then
contentTable = createContentTable(text)
local function numberToPercent(number)
if type(number) == "number" then
number = number.."%"
@/lua/ge/extensions/editor/trafficDebug.lua
local function doBulletTextInfo(key, value) -- validates and displays a bullet point line of text
local f = type(value) == "number" and "%0.2f" or "%s"
if type(value) ~= "number" or type(value) ~= "string" then value = tostring(value) end
local f = type(value) == "number" and "%0.2f" or "%s"
if type(value) ~= "number" or type(value) ~= "string" then value = tostring(value) end
im.BulletText(string.format(key..": "..f, value))
local f = type(value) == "number" and "%0.2f" or "%s"
if type(value) ~= "number" or type(value) ~= "string" then value = tostring(value) end
im.BulletText(string.format(key..": "..f, value))
@/lua/common/jbeam/io.lua
if #slotSectionRow > 2 and type(slotSectionRow[3]) == 'string' then
slot.description = slotSectionRow[3]
end
if #slotSectionRow > 3 and type(slotSectionRow[4]) == 'table' then
tableMerge(slot, slotSectionRow[4])
local function _processSlotsDestructiveLegacy(part, sourceFilename)
if type(part.slots) ~= 'table' then return nil end
local newSlots = {}
if #part.slots > 0 and type(part.slots[1]) == 'table' and part.slots[1][1] ~= 'type' then
-- backward compatibility: some parts miss the table header, which worked due to limitations before.
--log('I', "", "Processing slots in file " .. tostring(sourceFilename) .. " ..." .. dumpsz(part, 2))
if type(part.slots) ~= 'table' and type(part.slots2) ~= 'table' then return nil end
--log('I', "", "Processing slots in file " .. tostring(sourceFilename) .. " ..." .. dumpsz(part, 2))
if type(part.slots) ~= 'table' and type(part.slots2) ~= 'table' then return nil end
if type(part.slotType) ~= 'string' and type(part.slotType) ~= 'table' then
log('E', "jbeam.loadJBeamFile", "part does not have a slot type. Ignoring: "..tostring(filename) .. ' - ' .. dumpsz(part, 2))
if type(part.slotType) ~= 'string' and type(part.slotType) ~= 'table' then
log('E', "jbeam.loadJBeamFile", "part does not have a slot type. Ignoring: "..tostring(filename) .. ' - ' .. dumpsz(part, 2))
-- support for a part that fits in the correct slottype
if type(part.slotType) == 'string' then
parts[partName].slotTypes = {part.slotType}
parts[partName].slotTypes = {part.slotType}
elseif type(part.slotType) == 'table' then
parts[partName].slotTypes = part.slotType
local function isContextValid(ioCtx)
return type(ioCtx.preloadedDirs) == 'table'
end
if part then
local partSlotType = type(part.slotType)
if partSlotType == 'string' then
@/lua/ge/extensions/tech/platoonFunctions.lua
local mailBoxName = "currentLeader"..vehicle
print(type(vehicle))
be:sendToMailbox(vehicle, lpack.encodeBinWorkBuffer(i))
@/inspector/Models/CSSRule.js
get type()
{
@/lua/ge/extensions/flowgraph/nodes/vehicle/spawnVehicle.lua
local config = self.pinIn.config.value
local configKey = type(config) == 'string' and config or 'base' -- this is required for function core_vehicles.getConfig
if string.find(configKey, '.pc') then
local paintValue = self.pinIn.color.value
if self.pinIn.randomColor.value or type(paintValue) == 'string' then
local allPaints = nil
if modelData and modelData.model then
if type(paintValue) == 'string' then
paint = modelData.model.paints[paintValue] -- if paint value is string
end
elseif type(paintValue) == 'table' and (paintValue.baseColor or paintValue[4]) then
paint = paintValue
@/lua/ge/extensions/freeroam/facilities.lua
if path == nil then return fallbackPath end
if type(path) ~= "table" then path = {path} end
for _, p in ipairs(path) do
f.sitesFile = f.sitesFile or "facilities.sites.json"
if type(f.sitesFile) == "table" then
for index, file in ipairs(f.sitesFile) do
local sites = {}
if type(facility.sitesFile) == "string" then
table.insert(sites, gameplay_sites_sitesManager.loadSites(facility.sitesFile))
local sites = {}
if type(facility.sitesFile) == "string" then
table.insert(sites, gameplay_sites_sitesManager.loadSites(facility.sitesFile))
@/lua/ge/extensions/editor/flowgraph/nodelibrary.lua
for k,v in pairs(dir) do
if type(v) == 'table' then
return self:hasFoldersOnly(v)
if type(self.newNodeLinkPin.type) == "table" then
for _, t in ipairs(self.newNodeLinkPin.type) do
local pinTypesToCheck = {}
if type(self.newNodeLinkPin.type) == 'table' then
for i=1,#self.newNodeLinkPin.type do
@/lua/common/libs/lua-luaepnf/epnf.lua
local function dump_ast( node, prefix )
if type( node ) == "table" then
write( "{" )
write( "\n" )
if type( node.id ) == "string" and
type( node.pos ) == "number" then
if type( node.id ) == "string" and
type( node.pos ) == "number" then
write( prefix, " id = ", node.id,
@/lua/ge/extensions/core/modmanager.lua
end
if type(mods[modname].modData.attachments) == 'table' then
mods[modname].modData.imgs = {}
end
if type(mods[modname].modData.icon) == 'string' then
mods[modname].modData.icon = mods[modname].modInfoPath .. mods[modname].modData.icon
local modData = jsonReadFile(persistencyfile)
local modsInstalled = (type(modData) == 'table' and type(modData.mods) == 'table' and not tableIsEmpty(modData.mods))
if modsInstalled then
local modData = jsonReadFile(persistencyfile)
local modsInstalled = (type(modData) == 'table' and type(modData.mods) == 'table' and not tableIsEmpty(modData.mods))
if modsInstalled then
@/lua/common/jbeamWriter.lua
if v == nil then return "null" end
local vtype = type(v)
if vtype == 'string' then return stringformat('"%s"', escapeString(v)) end
@/lua/ge/extensions/tech/pythonExport.lua
local function formatValueAsPython(value)
if type(value) == 'boolean' then
return value and 'True' or 'False'
end
if type(value) == 'cdata' and ffi.offsetof(value, 'z') ~= nil then -- vec3
if ffi.offsetof(value, 'w') ~= nil then -- quat
end
if type(value) == 'number' then
if math.floor(value) ~= value then
end
if type(value) == 'table' then
local first = true
@/lua/common/libs/luasec/ssl.lua
if param then
if type(param) == "table" then
return func(ctx, unpack(param))
for k, v in ipairs(array) do
if type(v) ~= "string" then return nil end
local len = #v
if certificate.password and
type(certificate.password) ~= "function" and
type(certificate.password) ~= "string"
type(certificate.password) ~= "function" and
type(certificate.password) ~= "string"
then
if cfg.dhparam then
if type(cfg.dhparam) ~= "function" then
return nil, "invalid DH parameter type"
if cfg.mode == "server" and cfg.alpn then
if type(cfg.alpn) == "function" then
local alpncb = cfg.alpn
local protocols = alpncb(wireformat2array(str))
if type(protocols) == "string" then
protocols = { protocols }
protocols = { protocols }
elseif type(protocols) ~= "table" then
return nil
if not succ then return nil, msg end
elseif type(cfg.alpn) == "table" then
local protocols = cfg.alpn
local alpn
if type(cfg.alpn) == "string" then
alpn, msg = array2wireformat({ cfg.alpn })
alpn, msg = array2wireformat({ cfg.alpn })
elseif type(cfg.alpn) == "table" then
alpn, msg = array2wireformat(cfg.alpn)
local ctx, msg
if type(cfg) == "table" then
ctx, msg = newcontext(cfg)
@/lua/common/libs/binaryheap/binaryheap.lua
-- A plain heap carries a single piece of information per entry. This can be
-- any type (except `nil`), as long as the comparison function used to create
-- the heap can handle it.
--
-- 1. The `value`, this is used for ordering the heap. It can be any type (except
-- `nil`), as long as the comparison function used to create the heap can
-- handle it.
-- 2. The `payload`, this can be any type (except `nil`), but it MUST be unique.
--
@/lua/common/libs/copas/copas/timer.lua
assert(opts.delay >= 0, "delay must be greater than or equal to 0")
assert(type(opts.callback) == "function", "expected callback to be a function")
return setmetatable({
@/inspector/Models/TimelineMarker.js
get type() { return this._type; }
get details() { return this._details; }
@/lua/common/libs/luasocket/socket/http.lua
_M.request = socket.protect(function(reqt, body)
if base.type(reqt) == "string" then return srequest(reqt, body)
else return trequest(reqt) end
@/lua/ge/extensions/scenario/speedGoal.lua
for _,i in ipairs(instance.value.wayPointNum) do
if type(i) == "number" then
if vehWpData.cur ==i then
if instance.value.minSpeed and type(instance.value.minSpeed)~="number" then
log('E', logTag, ' minSpeed must contain number value ')
end
if instance.value.maxSpeed and type(instance.value.maxSpeed)~= "number" then
log('E', logTag, ' maxSpeed must contain number value ')
end
if instance.value.wayPointNum and type(instance.value.wayPointNum) ~="table" then
log('E', logTag, ' wayPointNum is not of type array ')
end
if instance.value.delay and type(instance.value.delay)~="number" then
log('E', logTag,'delay must contain number value ')
end
if instance.value.purpose and type(instance.value.purpose)~="string" then
log('E', logTag,'purpose is missing in json file or purpose has wrong type ')
@/lua/vehicle/powertrain/sequentialGearbox.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
if type(device.transmissionNodeID) ~= "number" then
device.transmissionNodeID = nil
local gearWhineCoefsOutput = jbeamData.gearWhineCoefsOutput or jbeamData.gearWhineCoefs
if gearWhineCoefsOutput and type(gearWhineCoefsOutput) == "table" then
local gearIndex = device.minGearIndex
local gearWhineCoefsInput = jbeamData.gearWhineCoefsInput or jbeamData.gearWhineCoefs
if gearWhineCoefsInput and type(gearWhineCoefsInput) == "table" then
local gearIndex = device.minGearIndex
if jbeamData.gearboxNode_nodes and type(jbeamData.gearboxNode_nodes) == "table" then
device.transmissionNodeID = jbeamData.gearboxNode_nodes[1]
@/inspector/Models/TextMarker.js
get type()
{
@/lua/vehicle/controller/propAnimation/sequentialLever.lua
relevantGearbox = powertrain.getDevice(gearboxName)
if type(jbeamData.shiftSoundNode_nodes) == "table" and jbeamData.shiftSoundNode_nodes[1] and type(jbeamData.shiftSoundNode_nodes[1]) == "number" then
shiftSoundNodeId = jbeamData.shiftSoundNode_nodes[1]
relevantGearbox = powertrain.getDevice(gearboxName)
if type(jbeamData.shiftSoundNode_nodes) == "table" and jbeamData.shiftSoundNode_nodes[1] and type(jbeamData.shiftSoundNode_nodes[1]) == "number" then
shiftSoundNodeId = jbeamData.shiftSoundNode_nodes[1]
@/lua/ge/extensions/scenario/damageGoal.lua
if instance.id == 'damage' then
if instance.value.damageLimit and type(instance.value.damageLimit) ~= "number" then
log('E', 'In '..tostring(scenario.name), ' damageLimit must contain number value ')
end
if instance.value.damageThreshold and type(instance.value.damageThreshold) ~= "number" then
log('E', 'In '..tostring(scenario.name), ' damageThreshold must contain number value ')
end
if instance.value.purpose and type(instance.value.purpose)~="string" then
log('E', 'In '..tostring(scenario.name),'purpose is missing in json file or purpose has wrong type ')
@/lua/vehicle/energyStorage/pressureTank.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/ge/extensions/editor/crawlEditor/paths.lua
end, ffi.string(flagsBuf))
if ok and type(decoded) == 'table' then
self.currentPathnode.flags = decoded
@/inspector/Models/CSSMedia.js
get type() { return this._type; }
get text() { return this._text; }
@/lua/ge/extensions/editor/buildingEditor.lua
if true then return end
-- lo('?? dump:'..tostring(lvl)..':'..type(t))
if type(t) == 'table' then
-- lo('?? dump:'..tostring(lvl)..':'..type(t))
if type(t) == 'table' then
local s = '{ '
for o,e in pairs(t) do
-- lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
local lt = U.dump(e, nil, 1)
for o,e in pairs(t) do
-- lo(type(o)..':'..type(e)..':'..o..':'..tostring(e))
local lt = U.dump(e, nil, 1)
else
-- lo('?? dump_nn:'..type(t)..':'..tostring(t))
return tostring(t)
@/lua/vehicle/powertrain/electricMotor.lua
for k, v in pairs(device.torqueCurve) do
if type(k) == "number" then
torqueCurve[k + 1] = v - device.friction - (device.dynamicFriction * k * rpmToAV)
local torqueReactionNodes_nodes = jbeamData.torqueReactionNodes_nodes
if torqueReactionNodes_nodes and type(torqueReactionNodes_nodes) == "table" then
local hasValidReactioNodes = true
for _, v in pairs(torqueReactionNodes_nodes) do
if type(v) ~= "number" then
hasValidReactioNodes = false
local tempElectricalEfficiencyTable = nil
if not jbeamData.electricalEfficiency or type(jbeamData.electricalEfficiency) == "number" then
tempElectricalEfficiencyTable = {{0, jbeamData.electricalEfficiency or 1}, {1, jbeamData.electricalEfficiency or 1}}
tempElectricalEfficiencyTable = {{0, jbeamData.electricalEfficiency or 1}, {1, jbeamData.electricalEfficiency or 1}}
elseif type(jbeamData.electricalEfficiency) == "table" then
tempElectricalEfficiencyTable = deepcopy(jbeamData.electricalEfficiency)
for k, v in pairs(copy) do
if type(k) == "number" then
table.insert(tempElectricalEfficiencyTable, {v[1] * 100, v[2]})
@/lua/common/jbeam/optimization.lua
for k, v in pairs(vehicle.beams) do
if type(v) == "table" and type(v.id1) == "number" and type(v.id2) == "number" and v.id1 > v.id2 then
v.id1, v.id2 = v.id2, v.id1
for k, v in pairs(vehicle.beams) do
if type(v) == "table" and type(v.id1) == "number" and type(v.id2) == "number" and v.id1 > v.id2 then
v.id1, v.id2 = v.id2, v.id1
for k, v in pairs(vehicle.beams) do
if type(v) == "table" and type(v.id1) == "number" and type(v.id2) == "number" and v.id1 > v.id2 then
v.id1, v.id2 = v.id2, v.id1
local function cleanupTable_rec(d, debugEnabled)
if type(d) ~= 'table' then return end
-- what to clean up now
for k, v in pairs(d) do
if type(v) == 'string' and v == '' and k ~= 'mesh' then -- 'mesh' is a hack to prevent from cleaning flexbody.mesh values. Backward compatibility
d[k] = nil
if n.collision == true then n.collision = nil end -- the default
if type(n.chemEnergy) ~= 'number' or n.chemEnergy == 0 then n.chemEnergy = nil end
if not n.flashPoint then
for k, tn in pairs(wheel.nodes) do
wheel.nodes[k] = type(tn) == 'table' and tn.cid or tn
end
for keyEntry, entry in pairs(vehicle) do
if type(entry) == "table" and tableIsDict(entry) and jbeamUtils.ignoreSections[keyEntry] == nil and tableIsDict(entry[0]) and entry[0]['disableSection'] ~= nil then
--log('D', "jbeam.postProcess"," - removing disabled section '"..keyEntry.."'")
@/lua/ge/extensions/util/renderComponentsAPI.lua
end
if type(s.settings) == 'table' then
recursiveSetupSettings(s.settings)
@/lua/common/tech/techCommunication.lua
for k, v in pairs(tab) do
k = type(k) == 'number' and k or tostring(k)
local t = type(v)
@/lua/common/jbeam/variables.lua
for key, v in pairs(d) do
local typev = type(v)
if typev == "string" then
local val = vars[v]
if type(val) == "table" then d[key] = val.val else d[key] = val end
end
local val = vars[v]
if type(val) == "table" then
succeed[k] = val.val
if vv.unit == '' then vv.unit = nil end
if type(vv.min) ~= 'number' then
log('E', 'postProcess.variables', 'variable ' .. vv.name .. ' ignored, min not a number: ' .. dumps(vv))
end
if type(vv.max) ~= 'number' then
log('E', 'postProcess.variables', 'variable ' .. vv.name .. ' ignored, max not a number' .. dumps(vv))
end
if type(vv.default) ~= 'number' then
log('E', 'postProcess.variables', 'variable ' .. vv.name .. ' ignored, default not a number' .. dumps(vv))
local res = {}
if type(part.variables) ~= 'table' then return {} end
jbeamTableSchema.processTableWithSchemaDestructive(part.variables, res)
for k, v in pairs(allVariables) do
if type(v) == 'table' and k ~= '$components' then
newVars[v.name or k] = v
-- replace key
if type(k) == "string" and str_byte(k, 1) == 36 then -- $
local secondChar = str_byte(k, 2)
local varVal = svars[k]
if type(varVal) == "table" then
k = varVal.val
if type(v) == "table" then
v = replaceTableKeysRecursive(v, svars)
for k3, v3 in pairs(section) do
if type(v3) == 'table' then
vehicle.components[k3] = vehicle.components[k3] or {}
for k, v in pairs(t) do
if type(v) == "function" then
t[k] = nil
t[k] = nil
elseif type(v) == "table" then
setFunctionsToNil(v)
@/lua/ge/extensions/gameplay/missions/missionScreen.lua
local val
if type(mAttKey) == 'string' then
val = att.valuesByKey[m.additionalAttributes[attKey]]
val = att.valuesByKey[m.additionalAttributes[attKey]]
elseif type(mAttKey) == 'table' then
val = m.additionalAttributes[attKey]
for k, v in pairs(defaultUserSettings) do
if type(v) == "table" and type(flatSettings[k]) == "table" then
for k2, v2 in pairs(v) do
for k, v in pairs(defaultUserSettings) do
if type(v) == "table" and type(flatSettings[k]) == "table" then
for k2, v2 in pairs(v) do
for k, v in pairs(flatSettings) do
if type(v) == "table" and type(defaultUserSettings[k]) == "table" then
for k2, v2 in pairs(v) do
for k, v in pairs(flatSettings) do
if type(v) == "table" and type(defaultUserSettings[k]) == "table" then
for k2, v2 in pairs(v) do
info.label = m.starLabels[key]
if type(m.starLabels[key]) == "function" then
info.label = m.starLabels[key](m, flatSettings)
info.label = m.starLabels[key](m, flatSettings)
elseif type(m.starLabels[key]) == "string" then
info.label = {
@/lua/ge/extensions/util/terrainGenerator.lua
function C:setBitmapFromArray(array) -- creates bitmap data from an array
if type(array) ~= 'table' or not array[1] or not array[1][1] then --or type(array) ~= 'cdata'
log('E', logTag, 'Error with processing bitmap from array')
function C:setBitmapFromArray(array) -- creates bitmap data from an array
if type(array) ~= 'table' or not array[1] or not array[1][1] then --or type(array) ~= 'cdata'
log('E', logTag, 'Error with processing bitmap from array')
if data.macroDistAtten then
if type(data.macroDistAtten) == 'table' then data.macroDistAtten = table.concat(data.macroDistAtten, ' ') end
terrainMat:setField('macroDistAtten', 0, data.macroDistAtten)
if data.detailDistAtten then
if type(data.detailDistAtten) == 'table' then data.detailDistAtten = table.concat(data.detailDistAtten, ' ') end
terrainMat:setField('detailDistAtten', 0, data.detailDistAtten)
if data[field] then
if type(data[field]) == 'table' then data[field] = table.concat(data[field], ' ') end
terrainMat:setField(field, 0, data[field])
log('I', logTag, 'Processed materials from json: '..#self.materials)
elseif type(matData.materials) == 'table' then -- directly set materials array (risky)
self.materials = matData.materials
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamBeautifier.lua
local function deepcompare(t1,t2)
local ty1 = type(t1)
local ty2 = type(t2)
local ty1 = type(t1)
local ty2 = type(t2)
if ty1 ~= ty2 then return false end
@/lua/common/libs/lua-websockets/websocket/sync.lua
else
assert(type(fin) == 'number' and fin > 0)
bytes = fin
local ws_protocols_tbl = {''}
if type(ws_protocol) == 'string' then
ws_protocols_tbl = {ws_protocol}
ws_protocols_tbl = {ws_protocol}
elseif type(ws_protocol) == 'table' then
ws_protocols_tbl = ws_protocol
@/lua/common/utils/simpleProfiler/report.lua
-- duration filter (seconds) can be provided via meta; default to 0 (no filter)
local durationFilterSec = (meta and type(meta.durationFilterSec) == 'number') and meta.durationFilterSec or 0
local root = simpleProfilerGetJournal(true, durationFilterSec) or { children = {}, stats = {} }
@/lua/ge/extensions/core/inventory.lua
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function existItem(entryTable, valueObj)
-- log('I', logTag, 'existItem called ... type(entryTable) = '..type(entryTable) ..' type(valueObj) = '..type(valueObj))
-- dump(entryTable)
local function addItem(itemType, valueObj)
log('I', logTag, 'addItem called... itemType '..tostring(itemType)..' '..type(valueObj))
local valueObjType = type(valueObj)
local function removeItem(itemType, valueObj)
log('I', logTag, 'removeItem called... itemType '..tostring(itemType)..' '..type(valueObj))
local valueObjType = type(valueObj)
local result = nil
if type(itemEntry) == 'table' then
for _,v in ipairs(itemEntry) do
local itemType = '$$$_'..string.upper(key)
if type(entry) == 'table' then
for _,item in ipairs(entry) do
@/lua/ge/extensions/flowgraph/nodes/debug/log.lua
local msg = tostring(self.pinIn.value.value)
if type(self.pinIn.value.value) == 'table' then
msg = dumps(self.pinIn.value.value)
@/lua/ge/extensions/c2/panelPlugins/vehicleManager.lua
if not msg or type(msg) ~= 'table' then return end
@/lua/ge/extensions/tech/openStreetMapExporter.lua
for k, v in pairs(table) do
if type(v) == 'table' then
children[k] = v
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamSpellchecker.lua
local header = sectionData[1]
if type(header) ~= "table" then
log('W', "", filePath .. " *** Invalid table header: " .. dumpsz(header, 2))
if type(rowValue) ~= "table" then
log('W', "", filePath .. " *** Invalid table row: "..dumps(rowValue))
else
--log('D', "" *** "..tostring(rowKey).." = "..tostring(rowValue).." ["..type(rowValue).."]")
--[[
if #rowValue > headerSize + 1 then -- and type(rowValue[#rowValue]) ~= "table" then
log('W', "", "*** Invalid table header, must be as long as all table cells (plus one additional options column):")
local rv = rowValue[rk]
if type(rv) == 'table' and tableIsDict(rv) and #rowValue > headerSize then
mods = rv
@/lua/ge/extensions/gameplay/sites/customFields.lua
function C:removeTag(tag)
if type(tag) == 'number' then
tag = self.sortedTags[tag]
@/lua/ge/extensions/gameplay/drag/display.lua
for _,group in pairs(laneTree) do
if type(group) == "table" then
for _,light in pairs(group) do
for _,light in pairs(group) do
if type(light) == "table" and light.obj and simObjectExists(light.obj) then
light.obj:setHidden(true)
for _, group in pairs(laneTree) do
if type(group) == "table" then
for _, light in pairs(group) do
for _, light in pairs(group) do
if type(light) == "table" and light.obj and simObjectExists(light.obj) then
light.obj:setHidden(false)
for _, group in pairs(laneTree) do
if type(group) == "table" then
for _, light in pairs(group) do
for _, light in pairs(group) do
if type(light) == "table" and light.obj and simObjectExists(light.obj) then
light.obj:setHidden(true)
for _, group in pairs(laneTree) do
if type(group) == "table" then
for _, light in pairs(group) do
for _, light in pairs(group) do
if type(light) == "table" and light.obj and simObjectExists(light.obj) then
light.obj:setHidden(false)
for _, group in pairs(laneTree) do
if type(group) == "table" then
for _, light in pairs(group) do
for _, light in pairs(group) do
if type(light) == "table" and light.obj and simObjectExists(light.obj) then
light.obj:setHidden(true)
@/lua/common/extensions/ui/imgui_custom_luaintf.lua
if x == 1 then x = true end
if type(x) ~= 'boolean' then
-- log('E', 'luaintf', 'conversion error')
function M.IntPtr(x)
if type(x) ~= 'number' then
-- log('E', 'luaintf', 'conversion error')
function M.FloatPtr(x)
if type(x) ~= 'number' then
-- log('E', 'luaintf', 'conversion error')
function M.DoublePtr(x)
if type(x) ~= 'number' then
-- log('E', 'luaintf', 'conversion error')
@/lua/ge/extensions/editor/util/transformUtil.lua
else
self.scl = vec3(1, 1, 1) * (type(self.scl) == 'number' and self.scl or 1)
self.inputScl = im.ArrayFloat(3)
if self.oneDimensionalScale then
if scl and type(scl) ~= 'number' then
scl = (scl and (scl.x or scl[1])) or 1
else
if scl and type(scl) == 'number' then
scl = vec3(1, 1, 1) * (scl or 1)
@/lua/vehicle/partCondition.lua
for k, v in pairs(partData) do
if type(v) == "table" then
if k == "powertrain" then
else
if type(v) == "table" and #v[i] > 1 then
local deviceType = v[i][1]
else
if type(v) == "table" and #v[i] > 1 then
local storageType = v[i][1]
partTypeTags[partId] = partTypeTags[partId] or {}
local breakGroups = type(beam.breakGroup) == "table" and beam.breakGroup or {beam.breakGroup}
for _, breakGroup in ipairs(breakGroups) do
local visualState = visual
if type(visual) == "number" then
local visualValue = visual
@/lua/vehicle/powertrain/electricWinch.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/ge/extensions/ui/gameplayAppContainers.lua
local goTtl = nil
if type(data) == 'table' then
for i = 1, #data do
local head = data[i] and data[i][1]
if type(head) == 'number' or head == 'ui.scenarios.go' then
isCountdown = true
@/inspector/Models/PropertyPreview.js
get name() { return this._name; }
get type() { return this._type; }
get subtype() { return this._subtype; }
@/lua/ge/extensions/ui/gameplaySelector/tileSorting.lua
function M.getSortFunction(sortMode)
if not sortMode or type(sortMode) ~= 'string' then
log("W", "tileSorting", "Invalid sort mode provided: " .. tostring(sortMode))
function M.convertUIValueToSortMode(uiValue)
if not uiValue or type(uiValue) ~= 'string' then
return DEFAULT_SORT_MODE -- Default fallback
@/lua/ge/extensions/scenario/distanceGoal.lua
if instance.id == 'distance' then
if instance.value.maxDistance and type(instance.value.maxDistance) ~= "number" then
log('E', 'In '..tostring(scenario.name), ' maxDistance must contain number value')
end
if instance.value.distanceEnable and type(instance.value.distanceEnable) ~= "number" then
log('E', 'In '..tostring(scenario.name), ' distanceEnable must contain number value')
end
if instance.value.minDistance and type(instance.value.minDistance) ~= "number" then
log('E', 'In '..tostring(scenario.name), ' minDistance must contain number value')
end
if instance.value.purpose and type(instance.value.purpose)~="string" then
log('E', 'In '..tostring(scenario.name),'purpose is missing in json file or purpose has wrong type ')
@/lua/vehicle/controller/pneumatics/airbrakes.lua
if jbeamData.soundNode_nodes and type(jbeamData.soundNode_nodes) == "table" and type(jbeamData.soundNode_nodes[1]) == "number" then
soundNode = jbeamData.soundNode_nodes[1]
if jbeamData.soundNode_nodes and type(jbeamData.soundNode_nodes) == "table" and type(jbeamData.soundNode_nodes[1]) == "number" then
soundNode = jbeamData.soundNode_nodes[1]
@/lua/ge/extensions/flowgraph/nodes/scene/setObjectField.lua
local val = self.pinIn.value.value
if type(val) =='table' then
val = table.concat(val,' ')
@/lua/ge/extensions/editor/util/vehicleFilterUtil.lua
local function cleanFilter(filter)
if not filter or type(filter) ~= "table" then return nil end
if cleaned.values then
if type(cleaned.values) ~= "table" then
-- Invalid values, remove filter
-- Range filter: preserve min/max if they're valid numbers
local hasMin = cleaned.values.min ~= nil and type(cleaned.values.min) == "number"
local hasMax = cleaned.values.max ~= nil and type(cleaned.values.max) == "number"
local hasMin = cleaned.values.min ~= nil and type(cleaned.values.min) == "number"
local hasMax = cleaned.values.max ~= nil and type(cleaned.values.max) == "number"
hasAnyValue = true
elseif type(value) ~= "boolean" then
-- Preserve non-boolean values (strings, numbers, tables, etc.)
-- Filter has no values field, but might have other important fields
-- Keep it if it has propName and type (might be valid)
if cleaned.propName and cleaned.type then
local function cleanFilterArray(filterArray)
if not filterArray or type(filterArray) ~= "table" then return {} end
local cleaned = {}
local function cleanBaseFilter(baseFilter)
if not baseFilter or type(baseFilter) ~= "table" then return {} end
local cleaned = {}
local function cleanProbabilitySettings(probabilitySettings)
if not probabilitySettings or type(probabilitySettings) ~= "table" then return {} end
local cleaned = {}
local min, max = propVal, propVal
if type(propVal) == 'table' then
min = propVal.min
end
if type(min) == 'number' and type(max) == 'number' then
if not filterByProp[propName] then
end
if type(min) == 'number' and type(max) == 'number' then
if not filterByProp[propName] then
local values = propVal
if type(values) == 'string' then
values = {values}
-- Check if it's the old format (array of vehicle configs) or new format (filter settings object)
if filterData and type(filterData) == "table" then
-- Check if it's old format (array with model/config entries) or new format (object with baseFilter, etc.)
@/lua/common/jbeam/groups.lua
for keyEntry, entry in pairs(vehicle) do
if type(entry) == "table" then
for rowKey, row in pairs(entry) do
for rowKey, row in pairs(entry) do
if type(row) == "table" then
local newGroups
local firstIdx
if row.group ~= nil and type(row.group) == "table" then
newGroups = {}
@/lua/ge/extensions/career/modules/milestones/milestones.lua
if a.time == b.time and a.entryId and b.entryId then
if type(a.entryId) == "number" and type(b.entryId) == "number" then
return a.entryId > b.entryId
if a.time == b.time and a.entryId and b.entryId then
if type(a.entryId) == "number" and type(b.entryId) == "number" then
return a.entryId > b.entryId
local function milestoneReached(label)
if type(label) == "string" then
guihooks.trigger("toastrMsg", {type="success", title="Milestone Reached!", msg=label})
guihooks.trigger("toastrMsg", {type="success", title="Milestone Reached!", msg=label})
elseif type(label) == "table" then
guihooks.trigger("toastrMsg", {type="success", title="Milestone Reached!", msg=label.txt, context=label.context})
@/lua/ge/extensions/flowgraph/nodes/util/distanceBetween.lua
function C:getPosition(pinInput)
if type(pinInput) == 'number' then
local veh = getObjectByID(pinInput)
@/lua/ge/extensions/career/modules/permissions.lua
local permissions = {}
if type(tags) ~= "table" then
tags = {tags}
@/lua/common/jsonPrettyEncoderCustom.lua
if a.w == b.w then
local typeA, typeB = type(a.s), type(b.s)
if typeA ~= typeB then
if a.w == b.w then
local typeA, typeB = type(a.s), type(b.s)
if typeA ~= typeB then
if v == nil then return "null" end
local vtype = type(v)
if vtype == 'string' then return string.format('"%s"', jsonEscapeString(v)) end
@/inspector/Views/NetworkTabContentView.js
get type()
{
@/lua/ge/extensions/gameplay/missions/progress.lua
-- automatically calculate the type (passed/completed etc) based on the stars
local currentType = "none"
-- gets value from attempt depending on type (type defines the location of value in attempt table)
local function getValueForAttemptUiProgressType(attempt, config)
-- gets value from aggregate depending on type (type defines the location of value in aggregate table)
local function getValueForAggregateUiProgressType(aggregate, config)
for key, value in pairs(data) do
if type(value) == 'string' or type(value) == 'number' then
context[key] = tostring(value)
for key, value in pairs(data) do
if type(value) == 'string' or type(value) == 'number' then
context[key] = tostring(value)
local label = mission.starLabels[key] or "Missing Star Description"
if type(label) == "string" then
label = {
}
elseif type(label) == "function" then
label = label(mission)
@/lua/vehicle/powertrain/hydraulicPump.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/inspector/Models/GarbageCollection.js
get type() { return this._type; }
get startTime() { return this._startTime; }
@/lua/common/libs/luamqtt/mqtt/ioloop.lua
-- associate ioloop with adding MQTT client
if type(client) ~= "function" then
client:set_ioloop(self)
-- unlink ioloop from MQTT client
if type(client) ~= "function" then
client:set_ioloop(nil)
for _, client in ipairs(self.clients) do
if type(client) ~= "function" then
client:_ioloop_iteration()
@/lua/objectpool/main.lua
local v = require("jbeam/stage2")
if type(initData) == "string" and string.len(initData) > 0 then
local state, initData = pcall(lpack.decode, initData)
local state, initData = pcall(lpack.decode, initData)
if state and type(initData) == "table" then
if initData.vdata then
else
log("E", "object", "invalid initData: " .. tostring(type(initData)) .. ": " .. tostring(initData))
end
@/lua/ge/extensions/core/hardwareinfo.lua
for k, v in pairs(res) do
if type(v) == 'table' then
v.state = 'ok'
@/lua/ge/extensions/gameplay/missions/missions.lua
end
if type(missionData.description) == "string" then
while string.endswith(missionData.description, "\n") do
for idx, key in pairs(missionData.careerSetup.defaultStarKeys) do
if type(idx) ~= "number" then
isNonNumeric = true
end
if type(mission) == 'string' then
log("E", "", "Unable to construct mission "..dumps(missionData.id).." of type "..dumps(missionData.missionType)..", something went wrong:")
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/trackVehicleDistanceToPos.lua
if self.targetPos == nil then
if type(self.pinIn.pos.value) == "table" and not self.pinIn.pos.value.x then
self.targetPos = vec3(self.pinIn.pos.value)
@/lua/vehicle/controller/propAnimation/singleAxisLever.lua
if type(jbeamData.shiftSoundNode_nodes) == "table" and jbeamData.shiftSoundNode_nodes[1] and type(jbeamData.shiftSoundNode_nodes[1]) == "number" then
shiftSoundNodeId = jbeamData.shiftSoundNode_nodes[1]
if type(jbeamData.shiftSoundNode_nodes) == "table" and jbeamData.shiftSoundNode_nodes[1] and type(jbeamData.shiftSoundNode_nodes[1]) == "number" then
shiftSoundNodeId = jbeamData.shiftSoundNode_nodes[1]
@/lua/common/testFramework/TestManager.lua
for name, func in pairs(tests) do
if type(func) == "function" and name:match("^test") then
table.insert(testNames, name)
@/lua/vehicle/tech/techVehicleUtils.lua
local name = nil
if type(node) == "string" then
name = node
@/lua/vehicle/fire.lua
--we can assume this node is part of the fire system
local staticBaseTemp = (type(node.baseTemp) == "number") and node.baseTemp or tEnv
flammableNodes[node.cid] = {
@/lua/vehicle/controller/hydraulics/hydraulicsCombustionEngineControl.lua
local relevantElectricsNames = jbeamData.relevantElectrics or {}
if type(relevantElectricsNames) == "table" then
for _, electricsName in pairs(relevantElectricsNames) do
@/lua/vehicle/energyStorage/fuelTank.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/inspector/Views/ContextMenu.js
type()
{
@/inspector/Views/StorageTabContentView.js
get type()
{
@/lua/ge/extensions/career/modules/milestones/general.lua
local name = c.getLabel(s, -1, -1)
if type(name) == "table" then name = translateLanguage(name.txt,name.txt, true) .. (dumps(name.context or {})) end
local target = c.getTarget(s)
local desc = c.getDescription(s, -1, target)
if type(desc) == "table" then desc = translateLanguage(desc.txt,desc.txt, true) .. (dumps(desc.context or {})) end
@/lua/ge/extensions/flowgraph/nodes/vehicle/alignForCoupling.lua
local desiredRot = quat()
if type(self.pinIn.rot.value) == 'number' then
desiredRot = quatFromEuler(0,0,self.pinIn.rot.value/180 * math.pi)
desiredRot = quatFromEuler(0,0,self.pinIn.rot.value/180 * math.pi)
elseif type(self.pinIn.rot.value) == 'table' then
desiredRot = quat(self.pinIn.rot.value)
@/lua/ge/extensions/editor/resourceChecker/resourceUtil.lua
local s = FS:fileSize(path)
return type(s) == 'number' and s or 0
end
local names = o:getMaterialNames()
if type(names) == "table" then
for _,n in pairs(names) do matsUsed[n] = true end
@/lua/ge/extensions/career/modules/marketplace.lua
local dr = chosenArchetype.delayRange
if type(dr) == "table" and dr[1] and dr[2] then
delayRange = { min = dr[1], max = dr[2] }
-- Return random quote from pool
if quotes and type(quotes) == "table" and #quotes > 0 then
local selectedQuote = quotes[math.random(1, #quotes)]
local insultQuotes = opponentPersonality.insultQuotes
if insultQuotes and type(insultQuotes) == "table" and #insultQuotes > 0 then
opponentQuote = insultQuotes[math.random(1, #insultQuotes)]
local happyQuotes = opponentPersonality.happyQuotes
if happyQuotes and type(happyQuotes) == "table" and #happyQuotes > 0 then
opponentQuote = happyQuotes[math.random(1, #happyQuotes)]
@/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
for _, v in pairs(shiftRPMNames) do
if type(jbeamDataCopy[v]) ~= "table" then
local shiftRPM = jbeamDataCopy[v] or defaultShiftPoints[v]
@/inspector/Views/ElementsTabContentView.js
get type()
{
@/lua/ge/extensions/core/levels.lua
if type(info["previews"]) == 'table' and #info["previews"] > 0 then
-- add prefix
local foundDefaultSpawn = false
if type(info.spawnPoints) == 'table' then
for _, point in pairs(info.spawnPoints) do
if type(info.minimap) == 'table' then
for _, elem in ipairs(info.minimap) do
local preview = nil
if type(level.previews) == 'table' and #level.previews > 0 then
preview = level.previews[1] -- Get the first preview
end
if type(nextSpawnVehicle) == 'table' then
local model, options = unpack(nextSpawnVehicle)
@/lua/ge/extensions/editor/missionEditor/objectives.lua
local l = self.missionInstance.starLabels[key]
if type(l) == "function" then
end
if type(l) == "string" then
return translateLanguage(l,l, true)
end
if type(l) == "table" then
return translateLanguage(l.txt, l.txt, true)
@/lua/ge/extensions/editor/assemblySpline/import.lua
obj:setPosition(entry.pos)
if type(entry.rot) == "string" then
local x, y, z, w = string.match(entry.rot, "([%-%d%.eE]+)%s+([%-%d%.eE]+)%s+([%-%d%.eE]+)%s+([%-%d%.eE]+)")
@/lua/ge/extensions/core/vehiclePaints.lua
local paintKey = "paint" .. i
if type(setup[paintKey]) == 'string' then
if not paintsByIdCache[setup[paintKey]] then
for pId, paint in pairs(collection.paints) do
if type(paint) == 'string' then paint = {id = paint} end
if not paintsByIdCache[paint.id] then
if type(paintKeyOrPaint) == 'string' then
debugLog("resolving paint " .. dumps(paintKeyOrPaint))
paint = modelPaints[paintKeyOrPaint]
elseif type(paintKeyOrPaint) == 'table' then
debugLog("resolving paint " .. dumps(paintKeyOrPaint.name))
local multiPaintSetup = nil
if type(multiPaintSetupKeyOrMultiPaintSetup) == 'string' then
if multiPaintSetupsByIdOrName[multiPaintSetupKeyOrMultiPaintSetup] then
end
elseif type(multiPaintSetupKeyOrMultiPaintSetup) == 'table' then
multiPaintSetup = multiPaintSetupKeyOrMultiPaintSetup
for _, paint in pairs(model.libraryPaints or {}) do
if type(paint) == 'string' then paint = {id = paint} end
local paintFromLibrary = getPaintById(paint.id)
@/lua/ge/extensions/core/cameraModes/relative.lua
function C:loadSlot(slot)
if type(slot) == 'string' then
--print(">> slot " .. tostring(slot) .. " is ID " .. tostring(self.slotNameIndexMap[slot]))
@/lua/ge/extensions/flowgraph/nodes/gameplay/race/pathDefaultStartTransform.lua
if self.pinIn.name.value then
if type(self.pinIn.name.value) == 'string' then
if self.data.useStringMatch then -- used in some special cases
end
elseif type(self.pinIn.name.value) == 'number' then
sp = self.path.startPositions.objects[self.pinIn.name.value]
@/lua/vehicle/powertrain/manualGearbox.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
if type(device.transmissionNodeID) ~= "number" then
device.transmissionNodeID = nil
local gearWhineCoefsOutput = jbeamData.gearWhineCoefsOutput or jbeamData.gearWhineCoefs
if gearWhineCoefsOutput and type(gearWhineCoefsOutput) == "table" then
local gearIndex = device.minGearIndex
local gearWhineCoefsInput = jbeamData.gearWhineCoefsInput or jbeamData.gearWhineCoefs
if gearWhineCoefsInput and type(gearWhineCoefsInput) == "table" then
local gearIndex = device.minGearIndex
if jbeamData.gearboxNode_nodes and type(jbeamData.gearboxNode_nodes) == "table" then
device.transmissionNodeID = jbeamData.gearboxNode_nodes[1]
if type(device.transmissionNodeID) ~= "number" then
device.transmissionNodeID = nil
@/lua/common/libs/lunajson/lunajson/encoder.lua
local tmp = o[0]
if type(tmp) == 'number' then -- arraylen available
builder[i] = '['
for k, v in pairs(o) do
if type(k) ~= 'string' then
error("non-string key")
end
return dispatcher[type(v)](v)
end
@/lua/ge/extensions/editor/shortcutLegend.lua
for modifierFlag, modifierName in pairs(modifierNames) do
if type(controlFlag) == "number" then
if bit.band(controlFlag, modifierFlag) ~= 0 then
for modifierFlag, modifierName in pairs(modifierNames) do
if type(controlFlag) == "number" then
if bit.band(controlFlag, modifierFlag) ~= 0 then
@/lua/common/libs/luasocket/socket/url.lua
function _M.absolute(base_url, relative_url)
if base.type(base_url) == "table" then
base_parsed = base_url
@/inspector/Models/URLBreakpoint.js
get type() { return this._type; }
get url() { return this._url; }
@/lua/ge/extensions/ui/apps/minimap/minimap.lua
local function resetOcclusionTransform(id)
if type(id) == "string" and id ~= "" then
occlusionTransforms[id] = nil
@/lua/ge/extensions/flowgraph/nodes/states/transition.lua
if not pins[name] then
pins[name] = type(pin.type) == 'string' and pin.type or 'any'
end
if not pins[name] then
pins[name] = type(pin.type) == 'string' and pin.type or 'any'
end
@/lua/ge/extensions/editor/rendererComponents.lua
end
elseif type(s.settings) == 'table' then
if level == 1 then
@/lua/ge/extensions/editor/meshSpline/import.lua
obj:setPosition(entry.pos)
if type(entry.rot) == "string" then
local x, y, z, w = string.match(entry.rot, "([%-%d%.eE]+)%s+([%-%d%.eE]+)%s+([%-%d%.eE]+)%s+([%-%d%.eE]+)")
@/lua/ge/extensions/scenario/waypointAction.lua
for i = 1, #instance.value.wayPointNum do
if type(instance.value.wayPointNum[i]) == "number" then
if vehWpData.cur == instance.value.wayPointNum[i] then
if instance.id == 'wayPointAction' then
if instance.value.wayPointNum and type(instance.value.wayPointNum) ~="table" then
log('E', 'In '..tostring(scenario.name), ' wayPointNum is not of type array ')
@/lua/ge/extensions/campaign/exploration.lua
state.locationInfoDisplayed = false
if state.triggerCallback and type(state.triggerCallback) == 'function' then
-- dump(state.triggerCallback)
@/lua/ge/extensions/flowgraph/nodes/ui/updatedUI/startScreenIntro.lua
local text = self.pinIn.text.value
if (type(text) == 'table' and text.txt == '') or text == '' then
text = nil
@/lua/common/libs/lustach/src/lustache/context.lua
if(type(value)) == "number" then
value = tostring(value)
@/lua/ge/extensions/gameplay/missions/proceduralMissionGenerators/busModeMissions.lua
mission.missionFolder = string.lower(level.levelName)..'-'..scenario.name
mission.previewFile = type(scenario.previews) == 'table' and scenario.previews[1] or scenario.previews or scenario.preview
mission.thumbnailFile = "/gameplay/missionTypes/busMode/thumbnail.jpg"
@/lua/ge/extensions/core/vehicle/inplaceEdit.lua
local function blinkParts(dtReal, dtSim, dtRaw, vehicle)
if type(vBundle.vdata.flexbodies) ~= 'table' then return end
local chosenPartName = vBundle.chosenParts[slot.type]
if type(chosenPartName) == 'string' then
if chosenPartName ~= '' and chosenPartName ~= 'nil' then
@/lua/vehicle/powertrain/centrifugalClutch.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/common/libs/luasocket/socket/socket.lua
return function(name, opt1, opt2)
if base.type(name) ~= "string" then
name, opt1, opt2 = "default", name, opt1
@/lua/common/jbeam/sections/nodeBeam.lua
if type(hydro.inExtent) == 'number' then
hydro.inLimit = hydro.inExtent / (bL + 1e-30)
if type(hydro.outExtent) == 'number' then
hydro.outLimit = hydro.outExtent / (bL + 1e-30)
if type(hydro.extentFactor) == 'number' then
hydro.factor = hydro.extentFactor / (bL + 1e-30)
if type(hydro.factor) == 'number' then
hydro.inLimit = 1 - math.abs(hydro.factor)
@/lua/ge/extensions/career/modules/logbook.lua
if a.time == b.time and a.entryId and b.entryId then
if type(a.entryId) == "number" and type(b.entryId) == "number" then
return a.entryId > b.entryId
if a.time == b.time and a.entryId and b.entryId then
if type(a.entryId) == "number" and type(b.entryId) == "number" then
return a.entryId > b.entryId
@/lua/common/jbeam/slotSystem.lua
--log('D', "jbeam.unifyParts"," *** "..tostring(sectionKey).." = "..tostring(section).." ["..type(section).."] -> "..tostring(sectionKey).." = "..tostring(target[sectionKey]).." ["..type(target[sectionKey]).."]")
if target[sectionKey] == nil then
--log('D', "jbeam.unifyParts"," *** "..tostring(sectionKey).." = "..tostring(section).." ["..type(section).."] -> "..tostring(sectionKey).." = "..tostring(target[sectionKey]).." ["..type(target[sectionKey]).."]")
if target[sectionKey] == nil then
-- care about the slotoptions if we are first
if type(section) == "table" and not tableIsDict(section) then
local localSlotOptions = deepcopy(slotOptions) or {}
end
elseif type(target[sectionKey]) == "table" and type(section) == "table" then
-- append to existing tables
end
elseif type(target[sectionKey]) == "table" and type(section) == "table" then
-- append to existing tables
-- check if magic $ appears in the KEY, if new value is a number (for example "$+MyFoo": 42)
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 existingModifierValue = target[sectionKey][k3] --in case we are trying to merge a modifier with another modifier, we need to check if this is the case
if type(existingModifierValue) == "number" then
--we need to merge a new modifier with an existing modifier, to do that, set our existing value of actualK3 to the existing value of the raw k3 (including the modifier syntax)
if type(existingValue) == "number" then --check if old value is also a number (and not null)
local secondChar = str_byte(k3, 2)
if slot.type then
if type(part.slotType) == 'string' and part.slotType == slot.type then
return true, nil
return true, nil
elseif type(part.slotType) == 'table' and not tableContains(part.slotType, slot.type) then
return true, nil
-- case 1: the slotType on the part side is a string only
if type(part.slotType) == 'string' then
local fits = tableContains(slot.allowTypes, part.slotType)
-- case 2: the slottype on the part is a table
elseif type(part.slotType) == 'table' then
local allowListed = false
@/lua/common/libs/luamqtt/mqtt/client.lua
for key, value in pairs(args) do
if type(key) ~= "string" then
error("expecting string key in args, got: "..type(key))
if type(key) ~= "string" then
error("expecting string key in args, got: "..type(key))
end
local value_type = type(value)
if key == "uri" then
-- validate connector content
assert(type(a.connector) == "table", "expecting connector to be a table")
assert(type(a.connector.connect) == "function", "expecting connector.connect to be a function")
assert(type(a.connector) == "table", "expecting connector to be a table")
assert(type(a.connector.connect) == "function", "expecting connector.connect to be a function")
assert(type(a.connector.shutdown) == "function", "expecting connector.shutdown to be a function")
assert(type(a.connector.connect) == "function", "expecting connector.connect to be a function")
assert(type(a.connector.shutdown) == "function", "expecting connector.shutdown to be a function")
assert(type(a.connector.send) == "function", "expecting connector.send to be a function")
assert(type(a.connector.shutdown) == "function", "expecting connector.shutdown to be a function")
assert(type(a.connector.send) == "function", "expecting connector.send to be a function")
assert(type(a.connector.receive) == "function", "expecting connector.receive to be a function")
assert(type(a.connector.send) == "function", "expecting connector.send to be a function")
assert(type(a.connector.receive) == "function", "expecting connector.receive to be a function")
if a.will then
assert(type(a.will.topic) == "string", "expecting will.topic to be a string")
assert(type(a.will.payload) == "string", "expecting will.payload to be a string")
assert(type(a.will.topic) == "string", "expecting will.topic to be a string")
assert(type(a.will.payload) == "string", "expecting will.payload to be a string")
if a.will.qos ~= nil then
if a.will.qos ~= nil then
assert(type(a.will.qos) == "number", "expecting will.qos to be a number")
assert(check_qos(a.will.qos), "expecting will.qos to be a valid QoS value")
if a.will.retain ~= nil then
assert(type(a.will.retain) == "boolean", "expecting will.retain to be a boolean")
end
for event, func in pairs(events) do
assert(type(event) == "string", "expecting event to be a string")
assert(type(func) == "function", "expecting func to be a function")
assert(type(event) == "string", "expecting event to be a string")
assert(type(func) == "function", "expecting func to be a function")
local handlers = self.handlers[event]
-- fetch and validate args
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(args.qos == nil or (type(args.qos) == "number" and check_qos(args.qos)), "expecting valid args.qos value")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(args.qos == nil or (type(args.qos) == "number" and check_qos(args.qos)), "expecting valid args.qos value")
assert(args.no_local == nil or type(args.no_local) == "boolean", "expecting args.no_local to be a boolean")
assert(args.qos == nil or (type(args.qos) == "number" and check_qos(args.qos)), "expecting valid args.qos value")
assert(args.no_local == nil or type(args.no_local) == "boolean", "expecting args.no_local to be a boolean")
assert(args.retain_as_published == nil or type(args.retain_as_published) == "boolean", "expecting args.retain_as_published to be a boolean")
assert(args.no_local == nil or type(args.no_local) == "boolean", "expecting args.no_local to be a boolean")
assert(args.retain_as_published == nil or type(args.retain_as_published) == "boolean", "expecting args.retain_as_published to be a boolean")
assert(args.retain_handling == nil or type(args.retain_handling) == "boolean", "expecting args.retain_handling to be a boolean")
assert(args.retain_as_published == nil or type(args.retain_as_published) == "boolean", "expecting args.retain_as_published to be a boolean")
assert(args.retain_handling == nil or type(args.retain_handling) == "boolean", "expecting args.retain_handling to be a boolean")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.retain_handling == nil or type(args.retain_handling) == "boolean", "expecting args.retain_handling to be a boolean")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.callback == nil or type(args.callback) == "function", "expecting args.callback to be a function")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.callback == nil or type(args.callback) == "function", "expecting args.callback to be a function")
-- fetch and validate args
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.callback == nil or type(args.callback) == "function", "expecting args.callback to be a function")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.callback == nil or type(args.callback) == "function", "expecting args.callback to be a function")
-- fetch and validate args
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(type(args) == "table", "expecting args to be a table")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(args.payload == nil or type(args.payload) == "string", "expecting args.payload to be a string")
assert(type(args.topic) == "string", "expecting args.topic to be a string")
assert(args.payload == nil or type(args.payload) == "string", "expecting args.payload to be a string")
assert(args.qos == nil or type(args.qos) == "number", "expecting args.qos to be a number")
assert(args.payload == nil or type(args.payload) == "string", "expecting args.payload to be a string")
assert(args.qos == nil or type(args.qos) == "number", "expecting args.qos to be a number")
if args.qos then
end
assert(args.retain == nil or type(args.retain) == "boolean", "expecting args.retain to be a boolean")
assert(args.dup == nil or type(args.dup) == "boolean", "expecting args.dup to be a boolean")
assert(args.retain == nil or type(args.retain) == "boolean", "expecting args.retain to be a boolean")
assert(args.dup == nil or type(args.dup) == "boolean", "expecting args.dup to be a boolean")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.dup == nil or type(args.dup) == "boolean", "expecting args.dup to be a boolean")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.properties == nil or type(args.properties) == "table", "expecting args.properties to be a table")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.callback == nil or type(args.callback) == "function", "expecting args.callback to be a function")
assert(args.user_properties == nil or type(args.user_properties) == "table", "expecting args.user_properties to be a table")
assert(args.callback == nil or type(args.callback) == "function", "expecting args.callback to be a function")
function client_mt:acknowledge(msg, rc, properties, user_properties)
assert(type(msg) == "table" and msg.type == packet_type.PUBLISH, "expecting msg to be a publish packet")
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(type(msg) == "table" and msg.type == packet_type.PUBLISH, "expecting msg to be a publish packet")
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(user_properties == nil or type(user_properties) == "table", "expecting user_properties to be a table")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(user_properties == nil or type(user_properties) == "table", "expecting user_properties to be a table")
-- validate args
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(user_properties == nil or type(user_properties) == "table", "expecting user_properties to be a table")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(user_properties == nil or type(user_properties) == "table", "expecting user_properties to be a table")
-- validate args
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(rc == nil or type(rc) == "number", "expecting rc to be a number")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(user_properties == nil or type(user_properties) == "table", "expecting user_properties to be a table")
assert(properties == nil or type(properties) == "table", "expecting properties to be a table")
assert(user_properties == nil or type(user_properties) == "table", "expecting user_properties to be a table")
assert(self.args.version == 5, "allowed only in MQTT v5.0 protocol")
function client_mt:close_connection(reason)
assert(not reason or type(reason) == "string", "expecting reason to be a string")
local conn = self.connection
conn.secure = true
if type(secure) == "table" then
conn.secure_params = secure
@/lua/ge/extensions/flowgraph/nodes/logic/edgeDetect.lua
function C:work()
if type(self.pinIn.signal.value) == "number" and type(self.lastSignal) == "number" and type(self.pinIn.threshold.value) == "number" then
self.pinOut.flow.value = math.abs(self.pinIn.signal.value - self.lastSignal) > (self.pinIn.threshold.value or 0.0001)
function C:work()
if type(self.pinIn.signal.value) == "number" and type(self.lastSignal) == "number" and type(self.pinIn.threshold.value) == "number" then
self.pinOut.flow.value = math.abs(self.pinIn.signal.value - self.lastSignal) > (self.pinIn.threshold.value or 0.0001)
function C:work()
if type(self.pinIn.signal.value) == "number" and type(self.lastSignal) == "number" and type(self.pinIn.threshold.value) == "number" then
self.pinOut.flow.value = math.abs(self.pinIn.signal.value - self.lastSignal) > (self.pinIn.threshold.value or 0.0001)
self.pinOut.flow.value = math.abs(self.pinIn.signal.value - self.lastSignal) > (self.pinIn.threshold.value or 0.0001)
elseif type(self.pinIn.signal.value) == "table" and type(self.lastSignal) == "table" then
local changed = false
self.pinOut.flow.value = math.abs(self.pinIn.signal.value - self.lastSignal) > (self.pinIn.threshold.value or 0.0001)
elseif type(self.pinIn.signal.value) == "table" and type(self.lastSignal) == "table" then
local changed = false
for i, v in ipairs(self.pinIn.signal.value) do
if type(v) == "number" and type(self.lastSignal[i]) == "number" and type(self.pinIn.threshold.value) == "number" then
changed = changed or math.abs(v - self.lastSignal[i]) > self.pinIn.threshold.value
for i, v in ipairs(self.pinIn.signal.value) do
if type(v) == "number" and type(self.lastSignal[i]) == "number" and type(self.pinIn.threshold.value) == "number" then
changed = changed or math.abs(v - self.lastSignal[i]) > self.pinIn.threshold.value
for i, v in ipairs(self.pinIn.signal.value) do
if type(v) == "number" and type(self.lastSignal[i]) == "number" and type(self.pinIn.threshold.value) == "number" then
changed = changed or math.abs(v - self.lastSignal[i]) > self.pinIn.threshold.value
self.pinOut.flow.value = changed
elseif type(self.pinIn.signal.value) ~= type(self.lastSignal) then
self.pinOut.flow.value = true
self.pinOut.flow.value = changed
elseif type(self.pinIn.signal.value) ~= type(self.lastSignal) then
self.pinOut.flow.value = true
@/lua/ge/extensions/flowgraph/nodes/scene/singleMarker.lua
oldPosIn = posIn
if type(radIn) == 'table' then
radIn = radIn[1]
@/lua/ge/extensions/scenario/positionGoal.lua
end
if instance.value.purpose and type(instance.value.purpose)~="string" then
log('E', 'In '..tostring(scenario.name),'purpose is missing in json file or purpose has wrong type ')
@/lua/ge/extensions/editor/vehicleEditor/liveEditor/veNodeTriSelfCollisionDetector.lua
for k,v in pairs(vdata) do
if type(v) == 'table' then
if v.couplerNodes then
@/lua/common/libs/luasocket/socket/ftp.lua
function metat.__index:type(type)
self.try(self.tp:command("type", type))
f:login(putt.user, putt.password)
if putt.type then f:type(putt.type) end
f:pasv()
_M.put = socket.protect(function(putt, body)
if base.type(putt) == "string" then return sput(putt, body)
else return tput(putt) end
f:login(gett.user, gett.password)
if gett.type then f:type(gett.type) end
f:pasv()
_M.get = socket.protect(function(gett)
if base.type(gett) == "string" then return sget(gett)
else return tget(gett) end
@/lua/common/devUtils.lua
if func then
if type(debug.traceback) ~= "function" then
fEnv.print = print_saved
local function _recFindUpvalues(moduleTbl, tbl, visitedEntries)
if type(tbl) ~= 'table' then return end
if visitedEntries[tostring(tbl)] then return {} end
for _, entry in pairs(tbl) do
if type(entry) == 'function' and not visitedEntries[tostring(entry)] then
visitedEntries[tostring(entry)] = true -- prevent infinite recursion
tableMerge(res, resSub)
--elseif type(entry) == 'table' then
-- tableMerge(res, _recFindUpvalues(moduleTbl, entry))
local v = rawget(t, k)
if type(v) == 'table' then
local newPath = path .. '/' .. tostring(k)
end
elseif type(v) ~= 'function' and type(v) ~= 'userdata' then
res[k] = v
end
elseif type(v) ~= 'function' and type(v) ~= 'userdata' then
res[k] = v
res = res .. path .. ' -> ' .. newPath .. ';\n'
if type(v) == 'table' then
res = res .. _createGraphviz(v, tablesVisited, newPath)
-- general fixes
if type(gui) == 'table' and type(gui.reset) == 'function' then gui.reset() end -- removes any temporary gui caches
-- general fixes
if type(gui) == 'table' and type(gui.reset) == 'function' then gui.reset() end -- removes any temporary gui caches
for k, v in pairs(_G) do
if (type(v) == 'table' and (rawget(v, '___type') or rawget(v, '___getters'))) or type(v) == 'function' or k == '_G' or k == 'extensions' or k == 'package' then goto continue end
if type(v) == 'table' and k ~= 'math' and k ~= 'ffi' and k ~= 'jit' and k ~= 'mime' and k ~= 'socket' then
for k, v in pairs(_G) do
if (type(v) == 'table' and (rawget(v, '___type') or rawget(v, '___getters'))) or type(v) == 'function' or k == '_G' or k == 'extensions' or k == 'package' then goto continue end
if type(v) == 'table' and k ~= 'math' and k ~= 'ffi' and k ~= 'jit' and k ~= 'mime' and k ~= 'socket' then
if (type(v) == 'table' and (rawget(v, '___type') or rawget(v, '___getters'))) or type(v) == 'function' or k == '_G' or k == 'extensions' or k == 'package' then goto continue end
if type(v) == 'table' and k ~= 'math' and k ~= 'ffi' and k ~= 'jit' and k ~= 'mime' and k ~= 'socket' then
if rawget(v, '__extensionName__') then goto continue end
for k, v in pairs(tbl) do
if type(v) == 'table' then
local newPath = path .. '/' .. tostring(k)
function tableFindRecursion(tbl)
if type(tbl) ~= 'table' then return nil end
local res = {}
@/lua/vehicle/extensions/core/quickAccess.lua
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= "function" and (type(args.title) ~= "string" or (type(args.onSelect) ~= "function" and type(args["goto"]) ~= "string")) then
-- TODO: add proper warning/error
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= "function" and (type(args.title) ~= "string" or (type(args.onSelect) ~= "function" and type(args["goto"]) ~= "string")) then
-- TODO: add proper warning/error
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= "function" and (type(args.title) ~= "string" or (type(args.onSelect) ~= "function" and type(args["goto"]) ~= "string")) then
-- TODO: add proper warning/error
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= "function" and (type(args.title) ~= "string" or (type(args.onSelect) ~= "function" and type(args["goto"]) ~= "string")) then
-- TODO: add proper warning/error
if type(args.level) ~= "string" then
log("E", "quickaccess", "Menu item level incorrect, needs to be a string: " .. dumps(args))
for _, e in ipairs(items) do
if type(e) == "table" then
if type(e.generator) == "function" then
if type(e) == "table" then
if type(e.generator) == "function" then
e.generator(items)
-- goto = dive into this new sub menu
if type(item["goto"]) == "string" and actionIndex == 1 then
return itemSelectCallback({"goto", item["goto"]})
return itemSelectCallback({"goto", item["goto"]})
elseif type(item.onSelect) == "function" and actionIndex == 1 then
itemSelectCallback(item.onSelect(item))
itemSelectCallback(item.onSelect(item))
elseif type(item.onSecondarySelect) == "function" and actionIndex == 2 then
itemSelectCallback(item.onSecondarySelect(item))
itemSelectCallback(item.onSecondarySelect(item))
elseif type(item.onTertiarySelect) == "function" and actionIndex == 3 then
itemSelectCallback(item.onTertiarySelect(item))
else
if type(item.onDeselect) == "function" and actionIndex == 1 then
itemSelectCallback(item.onDeselect(item))
itemSelectCallback(item.onDeselect(item))
elseif type(item.onSecondaryDeselect) == "function" and actionIndex == 2 then
itemSelectCallback(item.onSecondaryDeselect(item))
itemSelectCallback(item.onSecondaryDeselect(item))
elseif type(item.onTertiaryDeselect) == "function" and actionIndex == 3 then
itemSelectCallback(item.onTertiaryDeselect(item))
@/lua/ge/extensions/editor/levelValidator.lua
local function sortData(data)
if type(data) ~= "table" then
return data
table.insert(sortedData, data[field])
if type(sortedData[i]) == "table" then
if sortedData[i][1] then
@/lua/vehicle/powertrain/dctGearbox.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
local gearWhineCoefsOutput = jbeamData.gearWhineCoefsOutput or jbeamData.gearWhineCoefs
if gearWhineCoefsOutput and type(gearWhineCoefsOutput) == "table" then
local gearIndex = device.minGearIndex
local gearWhineCoefsInput = jbeamData.gearWhineCoefsInput or jbeamData.gearWhineCoefs
if gearWhineCoefsInput and type(gearWhineCoefsInput) == "table" then
local gearIndex = device.minGearIndex
if jbeamData.gearboxNode_nodes and type(jbeamData.gearboxNode_nodes) == "table" then
device.transmissionNodeID = jbeamData.gearboxNode_nodes[1]
if type(device.transmissionNodeID) ~= "number" then
device.transmissionNodeID = nil
@/lua/ge/extensions/trackbuilder/trackBuilder.lua
local function toBool(val)
if type(val) == "string" then
if val == "0" then return false elseif val == "1" then return true end
if val == "0" then return false elseif val == "1" then return true end
elseif type(val) == "number" then
if val == 0 then return false elseif val == 1 then return true end
else
log('E', logTag, "Type " .. type(val) .. " not supported by toBool() function!")
end
@/lua/ge/extensions/core/vehicle/manager.lua
local jbeamLoader = require("jbeam/loader")
log('D', 'vehicleLoader', 'partConfigData [' .. type(configDataIn) .. '] = ' .. dumps(configDataIn))
local vehicleConfig = extensions.core_vehicle_partmgmt.buildConfigFromString(vehicleDir, configDataIn)
local ok, summary = pcall(function() return vehicleObj:getMeshCacheRebuildSummary() end)
if ok and type(summary) == 'table' then meshCacheSummary = summary end
end
if paint and type(paint) == 'table' then
local paintsData = {}
@/lua/common/utils/interactiveShell.lua
if func then
if type(debug.traceback) ~= "function" then
print("*** LUA TRACEBACK BROKEN ***")
do
if type(updateLuaCore) == 'function' then updateLuaCore() end -- try to do garbage collection and cleanups
io.write("> ")
@/lua/vehicle/powertrain/turbocharger.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
maxWastegateLimit = 1
if type(turbo.wastegateStart) == "table" then
for k, v in pairs(turbo.wastegateStart) do
wastegateLimit = {}
if type(turbo.wastegateLimit) == "table" then
for k, v in pairs(turbo.wastegateLimit) do
end
elseif type(turbo.wastegateLimit) == "number" then
wastegateLimit[1] = (turbo.wastegateLimit or 0) * constants.psiToPascal
for k, _ in pairs(assignedEngine.torqueCurve) do
if type(k) == "number" and k < assignedEngine.maxRPM then
local rpm = floor(k)
@/lua/ge/extensions/editor/shapeEditor.lua
for k, v in pairs(data) do
if type(v) ~= 'table' then
im.TextUnformatted(tostring(v))
@/lua/common/libs/copas/copas/ftp.lua
_M.put = socket.protect(function(putt, body)
if type(putt) == "string" then
putt = _M.parseRequest(putt, body)
_M.get = socket.protect(function(gett)
if type(gett) == "string" then
gett = _M.parseRequest(gett)
@/lua/ge/extensions/scenario/waypoints.lua
local cur = branchWaypoint[#branchWaypoint]
if type(cur) == 'string' then
return {{branch = branchName, index = #branchWaypoint, cpName = cur }}
return {{branch = branchName, index = #branchWaypoint, cpName = cur }}
elseif type(cur) == 'table' then
for i,b in ipairs(cur) do
local cur = path[i]
if type(cur) == 'string' then
to = {
}
elseif type(cur) == 'table' then
to = {}
-- generate next from-list
if type(cur) == 'string' then
from = {{branch = pName, index = i, cpName = cur}}
from = {{branch = pName, index = i, cpName = cur}}
elseif type(cur) == 'table' then
from = {}
local cur = scenario.BranchLapConfig[#scenario.BranchLapConfig]
if type(cur) == 'string' then
from = {
}
elseif type(cur) == 'table' then
for i, branchName in ipairs(cur) do
for i, v in ipairs(branch) do
if type(v) == 'string' then
table.insert(M.state.waypointBranches[bName],v)
for i, v in ipairs(branch) do
if type(v) == 'string' then
table.insert(M.state.waypointBranches[bName],v)
@/lua/ge/extensions/editor/resourceChecker.lua
end
if type(x) == "table" then
local txtstring = m..": "
im.Text(m..": "..tostring(x))
if im.IsItemHovered() and type(x) == "string" then
texHovered(x)
@/lua/vehicle/powertrain/frictionClutch.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/inspector/Protocol/RemoteObject.js
get type()
{
@/lua/ge/extensions/flowgraph/nodes/career/vehicleGroupByClass.lua
if type(class) == 'number' then
local classArray = {"S", "A", "B", "C", "D"}
@/lua/ge/extensions/flowgraph/nodes/gameplay/traffic/getVehicle.lua
local id = self.pinIn.vehicleIds.value[self.pinIn.index.value]
if type(id) == 'number' then
self.pinOut.vehId.value = id
@/lua/vehicle/controller/sound/airbrakes.lua
if jbeamData.soundNode_nodes and type(jbeamData.soundNode_nodes) == "table" and type(jbeamData.soundNode_nodes[1]) == "number" then
soundNode = jbeamData.soundNode_nodes[1]
if jbeamData.soundNode_nodes and type(jbeamData.soundNode_nodes) == "table" and type(jbeamData.soundNode_nodes[1]) == "number" then
soundNode = jbeamData.soundNode_nodes[1]
@/lua/ge/extensions/editor/api/object.lua
local obj = scenetree.findObject(objName)
if obj and type(obj["onEditorEnable"]) == "function" and type(obj["onEditorDisable"]) == "function" then
if enable then
local obj = scenetree.findObject(objName)
if obj and type(obj["onEditorEnable"]) == "function" and type(obj["onEditorDisable"]) == "function" then
if enable then
@/lua/ge/extensions/editor/gen/mesh.lua
local sc = scale
if type(scale) ~= 'number' then
mtx:scale(scale)
local normnew = false
if not dnorm[akey[1]][akey[2]] and type(an)=='table' then
-- new normal
-- lo('?? ifizn:'..tostring(isnan(an))..':'..tostring(an)..':'..type(1)..':'..type({}))
local inorm = type(an) == 'table' and dnorm[akey[1]][akey[2]] or an
-- lo('?? ifizn:'..tostring(isnan(an))..':'..tostring(an)..':'..type(1)..':'..type({}))
local inorm = type(an) == 'table' and dnorm[akey[1]][akey[2]] or an
-- lo('?? ifizn:'..tostring(isnan(an))..':'..tostring(an)..':'..type(1)..':'..type({}))
local inorm = type(an) == 'table' and dnorm[akey[1]][akey[2]] or an
-- local inorm = isnan(an) and dnorm[akey[1]][akey[2]] or an
local dnorm = {}
if type(an) == 'table' then
-- if isnan(an) then
if askip[i] ~= nil and askip[i][j] ~= nil then
-- lo('??_________ for_TYPE:'..tostring(type(skip[i][j])))
toflip = type(askip[i][j]) == 'table' and askip[i][j][1] or false
-- lo('??_________ for_TYPE:'..tostring(type(skip[i][j])))
toflip = type(askip[i][j]) == 'table' and askip[i][j][1] or false
skip = type(askip[i][j]) == 'table' and askip[i][j][2] or askip[i][j]
toflip = type(askip[i][j]) == 'table' and askip[i][j][1] or false
skip = type(askip[i][j]) == 'table' and askip[i][j][2] or askip[i][j]
toflip = true
@/lua/common/jbeam/sections/licenseplatesSkins.lua
-- handling of slottypes properly with backward compatibility
if type(part.slotType) == 'string' then
isLicenseplate = part.slotType:find('_licenseplate')
isSkin = part.slotType:find('skin_') or part.slotType == 'paint_design'
elseif type(part.slotType) == 'table' then
for _, slotType in ipairs(part.slotType) do
for _, slotType in ipairs(part.slotType) do
isLicenseplate = isLicenseplate or (type(slotType) == 'string' and slotType:find('_licenseplate'))
isLicenseplateDesign = isLicenseplateDesign or (type(slotType) == 'string' and slotType:find('licenseplate_design'))
isLicenseplate = isLicenseplate or (type(slotType) == 'string' and slotType:find('_licenseplate'))
isLicenseplateDesign = isLicenseplateDesign or (type(slotType) == 'string' and slotType:find('licenseplate_design'))
isSkin = isSkin or (type(slotType) == 'string' and slotType:find('skin_') or slotType == 'paint_design')
isLicenseplateDesign = isLicenseplateDesign or (type(slotType) == 'string' and slotType:find('licenseplate_design'))
isSkin = isSkin or (type(slotType) == 'string' and slotType:find('skin_') or slotType == 'paint_design')
end
if isSkin then
local skinSlot = (type(part.skinType) == 'string' and part.skinType ~= '') and part.skinType or part.slotType
if skinSlot == 'paint_design' or type(skinSlot) ~= 'string' then skinSlot = '' end
local skinSlot = (type(part.skinType) == 'string' and part.skinType ~= '') and part.skinType or part.slotType
if skinSlot == 'paint_design' or type(skinSlot) ~= 'string' then skinSlot = '' end
vehicleObj:setSkin(skinSlot .. '.' .. (part.skinName or part.globalSkin or ''))
@/lua/ge/extensions/editor/assetDeduplicator.lua
local extBlacklist = {".imposter.dds",'.imposter_normals.dds'}
if type(jobData.blacklistExtensions) == "table" then
for _, ext in ipairs(jobData.blacklistExtensions) do
for _, ext in ipairs(jobData.blacklistExtensions) do
if type(ext) == "string" and ext ~= "" then
local e = ext:lower()
for _, folderTable in pairs(stockLevelsData) do
if type(folderTable) == "table" then
for path, info in pairs(folderTable) do
for _, folderTable in pairs(modLevelsData) do
if type(folderTable) == "table" then
for path, info in pairs(folderTable) do
@/lua/ge/extensions/core/quickAccess.lua
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= 'function' and (type(args.title) ~= 'string' or (type(args.onSelect) ~= 'function' and type(args["goto"]) ~= 'string')) then
-- TODO: add proper warning/error
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= 'function' and (type(args.title) ~= 'string' or (type(args.onSelect) ~= 'function' and type(args["goto"]) ~= 'string')) then
-- TODO: add proper warning/error
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= 'function' and (type(args.title) ~= 'string' or (type(args.onSelect) ~= 'function' and type(args["goto"]) ~= 'string')) then
-- TODO: add proper warning/error
local args = deepcopy(_args) -- do not modify the outside table by any chance
if type(args.generator) ~= 'function' and (type(args.title) ~= 'string' or (type(args.onSelect) ~= 'function' and type(args["goto"]) ~= 'string')) then
-- TODO: add proper warning/error
if type(args.level) ~= 'string' then
log('E', 'quickaccess', 'Menu item level incorrect, needs to be a string: ' .. dumps(args))
local vData = extensions.core_vehicle_manager.getVehicleData(vehId)
if vData and vData.vdata and type(vData.vdata.triggers) == 'table' then
for _, trg in pairs(vData.vdata.triggers or {}) do
for _, e in ipairs(entries) do
if type(e) == 'table' then
if type(e.generator) == 'function' then
if type(e) == 'table' then
if type(e.generator) == 'function' then
e.generator(entries)
for _, e in ipairs(items) do
if type(e) == "table" then
if type(e.generator) == "function" then
if type(e) == "table" then
if type(e.generator) == "function" then
e.generator(items)
if type(level) ~= 'string' then
if getPlayerVehicle(0) then
log('D', 'quickaccess.itemSelectCallback', 'called: ' .. dumps(actionResult))
if type(actionResult) ~= 'table' then
log('E', 'quickaccess.itemSelectCallback', 'invalid item result args: ' .. dumps(actionResult))
-- goto = dive into this new sub menu
if type(item["goto"]) == 'string' and actionIndex == 1 then
itemSelectCallback({'goto', item["goto"]})
return true
elseif type(item.onSelect) == 'function' and actionIndex == 1 then
itemSelectCallback(item.onSelect(item))
itemSelectCallback(item.onSelect(item))
elseif type(item.onSecondarySelect) == 'function' and actionIndex == 2 then
itemSelectCallback(item.onSecondarySelect(item))
itemSelectCallback(item.onSecondarySelect(item))
elseif type(item.onTertiarySelect) == 'function' and actionIndex == 3 then
itemSelectCallback(item.onTertiarySelect(item))
else
if type(item.onDeselect) == 'function' and actionIndex == 1 then
itemSelectCallback(item.onDeselect(item))
itemSelectCallback(item.onDeselect(item))
elseif type(item.onSecondaryDeselect) == 'function' and actionIndex == 2 then
itemSelectCallback(item.onSecondaryDeselect(item))
itemSelectCallback(item.onSecondaryDeselect(item))
elseif type(item.onTertiaryDeselect) == 'function' and actionIndex == 3 then
itemSelectCallback(item.onTertiaryDeselect(item))
local function selectItem(id, buttonDown, actionIndex)
if type(id) ~= 'number' then return end
if currentMenuItems == nil then return end
local function contextAction(id, buttonDown, actionIndex)
if type(id) ~= 'number' then return end
if currentMenuItems == nil then return end
end
if m.contextAction and type(m.contextAction) == 'function' then
m.contextAction()
local currentPath = (path and (path .. "/" .. key) or key)
if type(value) == "table" then
local isLowestLevel = true
for subKey, subValue in pairs(value) do
if type(subValue) == "table" then
isLowestLevel = false
@/lua/ge/extensions/flowgraph/nodes/gameplay/dragRace/setRacerDial.lua
if not dials or type(dials) ~= 'table' or #dials == 0 then
log('D', logTag, 'Dials table is required and must not be empty')
@/lua/vehicle/main.lua
local vehicle
if type(initData) == "string" and string.len(initData) > 0 then
profilerPushEvent("deserialize")
profilerPopEvent("deserialize")
if state and type(initData) == "table" then
if initData.vdata then
else
log("E", "vehicle", "invalid initData: " .. tostring(type(initData)) .. ": " .. tostring(initData))
end
function onCallEvent(funName, data)
if type(funName) ~= "string" then
return
local m = _G[string.sub(funName, 1, j - 1)]
if type(m) == "table" then
f = m[string.sub(funName, j + 1)]
if type(f) == "function" then
f(data)
@/lua/ge/extensions/tech/openDriveExporter.lua
for k, v in pairs(table) do
if type(v) == 'table' then
children[k] = v
@/lua/ge/extensions/core/vehicle/partmgmt.lua
local dataType = type(configData)
local fileData
if not inData or type(inData) ~= 'table' then
log('W', "partmgmt.mergeConfig", "invalid argument [" .. type(inData) .. '] = '..dumps(inData))
if not inData or type(inData) ~= 'table' then
log('W', "partmgmt.mergeConfig", "invalid argument [" .. type(inData) .. '] = '..dumps(inData))
return
@/lua/ge/simTimeAuthority.lua
local function setTargetSpeed(val)
if type(val) ~= "number" then
log("E","bullettime","Tried to set non-numeric speed: "..dumps(val))
@/lua/ge/extensions/core/hotlapping.lua
for _, info in ipairs(json) do
local radius = type(info.size) == 'table' and info.size[1] or info.size
M.addCheckPoint(vec3(info.position), vec3(info.direction), radius)
@/lua/vehicle/ai.lua
local function setSpeed(speed)
if type(speed) ~= 'number' then M.routeSpeed = nil else M.routeSpeed = speed end
end
if (arg.wpTargetList == nil and arg.path == nil and arg.script == nil) or
(type(arg.wpTargetList) ~= 'table' and type(arg.path) ~= 'table' and type(arg.script) ~= 'table') or
(arg.wpSpeeds ~= nil and type(arg.wpSpeeds) ~= 'table') or
if (arg.wpTargetList == nil and arg.path == nil and arg.script == nil) or
(type(arg.wpTargetList) ~= 'table' and type(arg.path) ~= 'table' and type(arg.script) ~= 'table') or
(arg.wpSpeeds ~= nil and type(arg.wpSpeeds) ~= 'table') or
if (arg.wpTargetList == nil and arg.path == nil and arg.script == nil) or
(type(arg.wpTargetList) ~= 'table' and type(arg.path) ~= 'table' and type(arg.script) ~= 'table') or
(arg.wpSpeeds ~= nil and type(arg.wpSpeeds) ~= 'table') or
(type(arg.wpTargetList) ~= 'table' and type(arg.path) ~= 'table' and type(arg.script) ~= 'table') or
(arg.wpSpeeds ~= nil and type(arg.wpSpeeds) ~= 'table') or
(arg.noOfLaps ~= nil and type(arg.noOfLaps) ~= 'number') or
(arg.wpSpeeds ~= nil and type(arg.wpSpeeds) ~= 'table') or
(arg.noOfLaps ~= nil and type(arg.noOfLaps) ~= 'number') or
(arg.routeSpeed ~= nil and type(arg.routeSpeed) ~= 'number') or
(arg.noOfLaps ~= nil and type(arg.noOfLaps) ~= 'number') or
(arg.routeSpeed ~= nil and type(arg.routeSpeed) ~= 'number') or
(arg.routeSpeedMode ~= nil and type(arg.routeSpeedMode) ~= 'string') or
(arg.routeSpeed ~= nil and type(arg.routeSpeed) ~= 'number') or
(arg.routeSpeedMode ~= nil and type(arg.routeSpeedMode) ~= 'string') or
(arg.driveInLane ~= nil and type(arg.driveInLane) ~= 'string') or
(arg.routeSpeedMode ~= nil and type(arg.routeSpeedMode) ~= 'string') or
(arg.driveInLane ~= nil and type(arg.driveInLane) ~= 'string') or
(arg.aggression ~= nil and type(arg.aggression) ~= 'number')
(arg.driveInLane ~= nil and type(arg.driveInLane) ~= 'string') or
(arg.aggression ~= nil and type(arg.aggression) ~= 'number')
then
@/lua/ge/extensions/ui/gridSelectorUtils/filterModule.lua
-- Set filter: use existing logic for option-based filters
if type(filterOptions) ~= 'table' or filterOptions == nil then
goto continue
if newFilters[propName] then
if type(lockedOptions) == 'table' then
-- For set filters, preserve locked options
@/lua/ge/extensions/campaign/campaigns.lua
if entry.dataType and entry.dataType == 'statistics' then
if entry.data and type(entry.data) == 'string' and entry.data == 'overall_pass' then
result = result or isOverallResultPass()
for _, v in ipairs(data.achievements) do
if v.key and type(v.key) == 'string' then
if achievementRequirementMet(v) then
@/lua/vehicle/scriptai.lua
local function setLogDataToCSV(val)
if val == true or (type(val) == 'string' and string.lower(val) ~= 'off') then
if type(val) == 'string' and string.lower(val) ~= 'on' then
if val == true or (type(val) == 'string' and string.lower(val) ~= 'off') then
if type(val) == 'string' and string.lower(val) ~= 'on' then
logDataToCSV = val
local fileName
if type(logDataToCSV) == 'string' then
fileName = csvLog:write(logDataToCSV)
if _externalForce == nil then _externalForce = inScript.externalForce end
externalForce = _externalForce and (type(_externalForce) == 'number' and _externalForce or 0.0004) or 0
hasCollided = false
@/lua/ge/extensions/editor/vehicleEditor/staticEditor/veJBeamModifierLeakVis.lua
local function replaceSpecialValues(val)
local typeval = type(val)
if typeval == "table" then
for sectionName, section in pairs(part) do
if type(section) == "table" and #section > 1 then
-- Go through each line in part's current section
end
elseif sectionName:match('^scale') and type(section) == "number" then
modsScalers[sectionName:sub(6, #sectionName)] = {modVal = section, partPath = partName}
if newSectionModifiers.collision and newSectionModifiers.collision.modVal == true then newSectionModifiers.collision.modVal = nil end -- the default
if newSectionModifiers.chemEnergy and (type(newSectionModifiers.chemEnergy.modVal) ~= 'number' or newSectionModifiers.chemEnergy.modVal == 0) then newSectionModifiers.chemEnergy.modVal = nil end
if newSectionModifiers.flashPoint and not newSectionModifiers.flashPoint.modVal then
local modVal = modData.modVal
local vehDataModValType = type(vehDataModVal)
local modValType = type(modVal)
local vehDataModValType = type(vehDataModVal)
local modValType = type(modVal)
local newModVal = deepcopy(modVal)
if type(newModVal) == "table" then
newModVal["__astNodeIdx"] = nil
local isScaled = false
if modsScalers[mod] and type(newModVal) == "number" and type(modsScalers[mod].modVal) == "number" then
newModVal = newModVal * modsScalers[mod].modVal
local isScaled = false
if modsScalers[mod] and type(newModVal) == "number" and type(modsScalers[mod].modVal) == "number" then
newModVal = newModVal * modsScalers[mod].modVal
local colData = lineData[lineCol]
if type(colData) == 'table' and tableIsDict(colData) and #lineData > headerSize then
for mod, modVal in pairs(colData) do
local newModVal = deepcopy(modVal)
if type(newModVal) == "table" then
newModVal["__astNodeIdx"] = nil
local isScaled = false
if modsScalers[mod] and type(newModVal) == "number" and type(modsScalers[mod].modVal) == "number" then
newModVal = newModVal * modsScalers[mod].modVal
local isScaled = false
if modsScalers[mod] and type(newModVal) == "number" and type(modsScalers[mod].modVal) == "number" then
newModVal = newModVal * modsScalers[mod].modVal
(
(type(modifiersDefaultValues[sectionName][mod]) == 'table' and not modifiersDefaultValues[sectionName][mod][modData.modVal]) or
(type(modifiersDefaultValues[sectionName][mod]) ~= 'table' and modData.modVal ~= modifiersDefaultValues[sectionName][mod])
(type(modifiersDefaultValues[sectionName][mod]) == 'table' and not modifiersDefaultValues[sectionName][mod][modData.modVal]) or
(type(modifiersDefaultValues[sectionName][mod]) ~= 'table' and modData.modVal ~= modifiersDefaultValues[sectionName][mod])
)
local vStr = nil
if type(v) == "string" then vStr = '"' .. v .. '"' else vStr = tostring(v) end
str = str .. '' .. k .. ' = ' .. vStr
local vStr = nil
if type(v) == "string" then vStr = '"' .. v .. '"' else vStr = tostring(v) end
str = str .. vStr
local modValStr = nil
local modValType = type(modVal)
@/inspector/Models/EventBreakpoint.js
get type() { return this._type; }
get eventName() { return this._eventName; }
@/lua/ge/extensions/core/jobsystem.lua
local ci = toRemove[i]
if type(coroutines[ci].exitcbl) == 'function' then
coroutines[ci].exitcbl(coroutines[ci])
@/lua/common/jbeam/sections/paints.lua
if paints and type(paints) == 'table' then
local paint = paints[1]
@/inspector/Models/Recording.js
get displayName() { return this._displayName; }
get type() { return this._type; }
get initialState() { return this._initialState; }
@/lua/common/lpack.lua
bufTmp:reset()
peekEncLua[type(v)](v)
return bufTmp:get()
serTmp[1] = 'a'
serTmp[peekEnc[type(v)](v, 2)] = '~'
local res = tableconcat(serTmp)
bufTmp:reset():put('b')
peekEncBin[type(v)](bufTmp, v)
return bufTmp:get()
bufTmp:reset():put('b')
peekEncBin[type(v)](bufTmp, v)
return bufTmp
else
bufTmp:putf(type(kk) == 'string' and "%s[%q]=" or "%s[%s]=", prefix, kk)
end
prefix = ","
peekEncLua[type(vv)](vv)
end
arrayidx = arrayidx + 1
peek[type(vv)](buf, vv)
else
buf:put('\3'):encode(kk)
peek[type(vv)](buf, vv)
end
arrayidx = arrayidx + 1
seridx = peek[type(vv)](vv, seridx)
else
dictlen = dictlen + 1
seridx = peek[type(vv)](vv, peek[type(kk)](kk, seridx + 1))
end
dictlen = dictlen + 1
seridx = peek[type(vv)](vv, peek[type(kk)](kk, seridx + 1))
end
dictlen = dictlen + 1
seridx = peek[type(vv)](vv, peek[type(kk)](kk, seridx))
end
dictlen = dictlen + 1
seridx = peek[type(vv)](vv, peek[type(kk)](kk, seridx))
end
@/lua/ge/extensions/flowgraph/nodes/gameplay/rally/vehicleStoppedNearPlane.lua
if type(posVal) == "table" then
-- Array format
if type(rotVal) == "table" then
-- Array format
@/lua/ge/extensions/editor/gen/world.lua
for i,d in pairs(daePath[tp]) do
local str = type(d) == 'string' and d or d[1]
if str == dae then
local sc = scale
if type(scale) ~= 'number' then
mtx:scale(scale)
if dae ~= nil then
if type(dae) == 'table' then
--TODO: handle better
@/lua/ge/extensions/editor/tech/roadArchitect/geometry.lua
-- [7] is the lane midpoint position at the point,
-- [8] is the lane type (string).
-- [9:11] is the lane width and left/right relative heights.
rdk[7] = (p1 + p2) * 0.5 -- [7] The lane midpoint (on top face).
rdk[8] = profile[k].type -- [8] The lane type ('road_lane', 'sidewalk', 'island', etc).
rdk[9], rdk[10], rdk[11] = laneWidth, heightL, heightR -- [9:11] The lane width, left/right relative heights.
rdk[7] = (p1 + p2) * 0.5 -- [7] The lane midpoint (on top face).
rdk[8] = profile[k].type -- [8] The lane type ('road_lane', 'sidewalk', 'island', etc).
rdk[9], rdk[10], rdk[11] = laneWidth, heightL, heightR -- [9:11] The lane width, left/right relative heights.
@/lua/ge/extensions/ui/messagesTasksAppContainers.lua
local function onDeserialize(data)
if type(data) ~= 'table' then
return
@/lua/vehicle/controller/braking/adaptiveBrakeLights.lua
end
if type(bool) == "boolean" then
return bool and 1 or 0
@/lua/common/libs/luaqrcode/qrencode.lua
local mp
if type(data)=="string" then
mp = convert_bitstring_to_bytes(data)
mp = convert_bitstring_to_bytes(data)
elseif type(data)=="table" then
mp = data
else
assert(false,"Unknown type for data: %s",type(data))
end
local function arrange_codewords_and_calculate_ec( version,ec_level,data )
if type(data)=="table" then
local tmp = ""
@/lua/common/libs/luamqtt/mqtt/luasocket_ssl.lua
function luasocket_ssl.connect(conn)
assert(type(conn.secure_params) == "table", "expecting .secure_params to be a table")
@/lua/ge/extensions/ui/topBar.lua
local selectItem = function(item)
local itemId = type(item) == "table" and item.id or item
local selectedItem = Config.TopBarEntries[itemId]
-- -- remove leading slash from state
-- if type(state) == "string" and string.sub(state, 1, 1) == "/" then
-- state = string.sub(state, 2)
-- -- 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/scenario/timeLimit.lua
if type(instance.value.maxTime) ~="number" and type(instance.value.waitTime) ~="number" then
log('E', 'In '..tostring(scenario.name), ' maxTime or waitTime have a wrong type it should be a number')
if type(instance.value.maxTime) ~="number" and type(instance.value.waitTime) ~="number" then
log('E', 'In '..tostring(scenario.name), ' maxTime or waitTime have a wrong type it should be a number')
if instance.value.countdown and type(instance.value.countdown)~="number" then
log('E', 'In '..tostring(scenario.name), ' countdown has a wrong type it should be a number')
@/lua/ge/extensions/core/environment.lua
gm.collisiontype = 0
if type(v.collisiontype) == 'string' then
gm.collisiontype = particles.getOrAddMaterialIDByName(materials, v.collisiontype)
@/lua/ge/extensions/career/modules/delivery/generator.lua
-- make weight into a table to pick random ones later
if type(item.weight) ~= "table" then
item.weight = {item.weight}
if type(item.slots) ~= "table" then
item.slots = {item.slots}
-- just to be sure... some semi-old save version saved it as numbers instead of tables...
if fac.materialStorages[generator.materialType] and type(fac.materialStorages[generator.materialType]) == "table" then
vol = fac.materialStorages[generator.materialType].storedVolume
vol = fac.materialStorages[generator.materialType].storedVolume
elseif fac.materialStorages[generator.materialType] and type(fac.materialStorages[generator.materialType]) == 'number' then
vol = fac.materialStorages[generator.materialType] or vol
local accessPointsByName = {}
if type(fac.sitesFile) == "string" then
table.insert(sites, gameplay_sites_sitesManager.loadSites(fac.sitesFile))
for _, filter in ipairs(fac.multiDropOffSpotFilter or {}) do
if type(filter) == "table" and filter.type == "byZone" then
local zoneName = filter.zoneName
@/lua/vehicle/extensions/dynamicVehicleData.lua
if oldData then
if type(oldData[k]) == "number" and type(v) == "number" then
local relativeDifference = math.abs(1 - (v / oldData[k]))
if oldData then
if type(oldData[k]) == "number" and type(v) == "number" then
local relativeDifference = math.abs(1 - (v / oldData[k]))
@/lua/common/jbeam/sections/meshs.lua
end
if type(v) == 'table' then
return ColorF(v.r / 255, v.g / 255, v.b / 255, v.a / 255)
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("#","")
if prop.materialOverride then
if #prop.materialOverride == 2 and type(prop.materialOverride[1])=="string" and type(prop.materialOverride[2])=="string" then
log('E', "jbeam.pushToPhysics", "prop="..dumps(prop.mesh)..".`materialOverride`: need to be array of array")
if prop.materialOverride then
if #prop.materialOverride == 2 and type(prop.materialOverride[1])=="string" and type(prop.materialOverride[2])=="string" then
log('E', "jbeam.pushToPhysics", "prop="..dumps(prop.mesh)..".`materialOverride`: need to be array of array")
if flexbody.materialOverride then
if #flexbody.materialOverride == 2 and type(flexbody.materialOverride[1])=="string" and type(flexbody.materialOverride[2])=="string" then
-- f:setMaterialOverride(flexbody.materialOverride[1], flexbody.materialOverride[2])
if flexbody.materialOverride then
if #flexbody.materialOverride == 2 and type(flexbody.materialOverride[1])=="string" and type(flexbody.materialOverride[2])=="string" then
-- f:setMaterialOverride(flexbody.materialOverride[1], flexbody.materialOverride[2])
@/lua/common/extensions/tech/techCapture.lua
local function convertBinaryDataToString(data)
local t = type(data)
if t == 'userdata' then
@/lua/ge/extensions/flowgraph/utils.lua
function M.getVariableType(value)
local t = type(value)
if t == "boolean" then t = "bool"
function M.isVariableCompatible(value, compType)
local t = type(value)
if t == "boolean" then return compType == 'bool'
if type(typeName) == 'table' then typeName = typeName[1] end
@/lua/vehicle/extensions/scenario/annotate.lua
data = deepcopy(_data)
if type(data.text) ~= 'string' then
log('E', 'annotate', 'invalid text for annotation extension')
@/lua/ge/extensions/editor/terrainEditor.lua
local function addTextureMap(path)
if type(path) ~= 'string' or #path == 0 then
-- log('W', '', 'The given path is either not a string or is empty.')
@/lua/ge/extensions/core/settings/settings.lua
for k,o in pairs(options) do
if type(o.get) == 'function' then
values[k] = o.get()
for k,o in pairs(options) do
if type(o.getModes) == 'function' then
o.modes = o.getModes()
values[key] = value
if options[key] and type(options[key].set) == 'function' then
options[key].set(value)
options[k].set = function(value)
if type(CppSettings[k]) == type(value) then
CppSettings[k] = value
options[k].set = function(value)
if type(CppSettings[k]) == type(value) then
CppSettings[k] = value
else
log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
end
else
log("E", "", string.format("Unable to parse setting '%s': it should be a %s, but is a %s. The ignored value is: %s", k, type(CppSettings[k]), type(value), dumps(value)))
end
@/lua/vehicle/controller/sound/reverseWarn.lua
if jbeamData.soundNode_nodes and type(jbeamData.soundNode_nodes) == "table" and type(jbeamData.soundNode_nodes[1]) == "number" then
soundNode = jbeamData.soundNode_nodes[1]
if jbeamData.soundNode_nodes and type(jbeamData.soundNode_nodes) == "table" and type(jbeamData.soundNode_nodes[1]) == "number" then
soundNode = jbeamData.soundNode_nodes[1]
@/lua/ge/extensions/editor/terrainMaterialsEditor.lua
if obj then
if type(actionData.property) == "table" then
if type(actionData.oldValue) == "table" then
if type(actionData.property) == "table" then
if type(actionData.oldValue) == "table" then
for k, prop in ipairs(actionData.property) do
if obj then
if type(actionData.property) == "table" then
if type(actionData.newValue) == "table" then
if type(actionData.property) == "table" then
if type(actionData.newValue) == "table" then
for k, prop in ipairs(actionData.property) do
local oldValue
if type(property) == "table" then
if type(value) == "table" then
if type(property) == "table" then
if type(value) == "table" then
oldValue = {}
local firstChar = tonumber(string.sub(ffi.string(terrainMtlCopyProxy.nameInput), 1, 1))
if firstChar and type(firstChar) == "number" then
notificationState = 1
@/lua/ge/extensions/ui/console.lua
-- im.Spacing()
if type(t.errors) == 'number' and t.errors > 0 then
im.TextColored(im.ImVec4(1.0, 0.0, 0.0, 1.0), tostring(t.errors) .. 'E ')
end
if type(t.warnings) == 'number' and t.warnings > 0 then
im.TextColored(im.ImVec4(1.0, 1.0, 0.0, 1.0), tostring(t.warnings) .. 'W')
for k,l in ipairs(logs) do
-- if type(l) == "table" then
r = _filter(logs[k], origFilter)
end
-- elseif r and type(l) == "string" then
-- logFiltered[lastEntry] = k
local t = history[historyPos]
if type(t) ~= "string" then
log("E","inputCallback", "history is corrupted (not str)")
-- if lvl == "A" then return end --So it doesn't add prints
if type(timer) == "string" then
t = timer
t = timer
elseif type(timer) == "number" then
t = string.format("%.3f", timer)
-- for _,l in ipairs(logs) do
-- if type(l) == "string" then
-- im.NextColumn()
-- for _,l in ipairs(logFiltered) do
-- if type(l) == "string" then
-- if viewColumn.time[0] then
-- end
-- if type(l) == "string" then
-- if viewColumn.time[0] then
-- for k,v in pairs(logFiltered) do
-- if type(v) == number and (i+logsHead+offset) >k and (i+logsHead+offset)<=v then tmp = true; print("brk");break; end
-- end
end
if type(l) == "string" then
-- if viewColumn.time[0] then
--table.insert(console_log_buffer, {'r', tostring(res)})
if type(res)=="string" and res:sub(1,7)== "Error: " then
log("E", "exec", res)
@/lua/vehicle/powertrain/splitShaft.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/lua/vehicle/energyStorage/electricBattery.lua
local integrityState = integrity
if type(integrity) == "number" then
local integrityValue = integrity
@/ui/lib/ext/angular/angular.js
* 1. All items are passed through the predicate (or predicates), and the returned values are saved
* along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed
* through a predicate that extracts the value of the `label` property, would be transformed to:
@/lua/ge/extensions/flowgraph/nodes/ui/endStats.lua
--direction, type, name, default, description, autoNumber
if type(p[2]) == 'table' and tableContains(p[2],'table') then
local pin = self:createPin('in',p[2],p[1]..'_'..i)
@/lua/ge/extensions/core/camera.lua
local oldCam = getGlobalCameras()[activeGlobalCameraName]
if oldCam and type(oldCam.onCameraChanged) == 'function' then oldCam:onCameraChanged(false) end
if newCam.setCustomData then newCam:setCustomData(customData or {}) end
if type(newCam.onCameraChanged) == 'function' then newCam:onCameraChanged(true) end
end
newCam.focused = true
if type(newCam.onCameraChanged) == 'function' then
newCam:onCameraChanged(true)
oldCam.focused = false
if type(oldCam.onCameraChanged) == 'function' then
oldCam:onCameraChanged(false)
local player, camName, withTransition, customData
if type(arg[1]) == "number" then
player, camName, withTransition, customData = unpack(arg, 1, table.maxn(arg)) -- without arguments, unpack can stop at the first nil it encounters, cutting the row short
-- sanitization
if type(jbeamConfig.distance) == 'string' then jbeamConfig.distance = tonumber(jbeamConfig.distance) end
if type(jbeamConfig.distanceMin) == 'string' then jbeamConfig.distanceMin = tonumber(jbeamConfig.distanceMin) end
if type(jbeamConfig.distance) == 'string' then jbeamConfig.distance = tonumber(jbeamConfig.distance) end
if type(jbeamConfig.distanceMin) == 'string' then jbeamConfig.distanceMin = tonumber(jbeamConfig.distanceMin) end
tableMergeRecursive(camera, jbeamConfig)
if type(camera.onVehicleCameraConfigChanged) == 'function' then
camera:onVehicleCameraConfigChanged()
if cam.order then
if type(cam.order) == 'number' then
if cam.order < orderMin then
else
log("E", "", "Incorrectly defined camera, 'order' field is not numeric: "..dumps(type(order)))
end
if camera.wasFocused then
if type(camera.onCameraChanged) == 'function' then
camera:onCameraChanged(camera.focused)
camera.focused = true
if type(camera.onCameraChanged) == 'function' then
camera:onCameraChanged(camera.focused)
local vehID, camName
if type(camId) == "number" then
vehID = camId
vehID = camId
elseif type(camId) == "table" then
vehID = camId.vehId
local c = vdata.cameras[camName or vdata.focusedCamName]
if c and type(c[fct]) == 'function' then
return c[fct](c, ...) -- c = self
if getActiveCamName() == 'path' or triggeredDuringSpawning then
if type(trigger.cameraOnEnter) == 'string' and trigger.cameraOnEnter ~= "" then
local cam = scenetree.findObject(trigger.cameraOnEnter)
end
elseif trigger.event == 'enter' and type(trigger.cameraOnEnter) == 'string' and trigger.cameraOnEnter ~= "" then
local cam = scenetree.findObject(trigger.cameraOnEnter)
@/lua/vehicle/bdebugImpl.lua
local txt = nil
if type(node.group) == "table" then
txt = '{'
if beam.breakGroup and beam.breakGroup ~= "" then
local breakGroups = type(beam.breakGroup) == "table" and beam.breakGroup or {beam.breakGroup}
for _, g in pairs(breakGroups) do
if beam.deformGroup and beam.deformGroup ~= "" then
local deformGroups = type(beam.deformGroup) == "table" and beam.deformGroup or {beam.deformGroup}
for _, g in pairs(deformGroups) do
local boundZone = type(beam.boundZone) == 'number' and beam.boundZone or 1
local shortBoundTransEnd = type(beam.shortBoundRange) == 'number' and max(restLen - max(0, beam.shortBoundRange) - boundZone, 0) or max((restLen * max(1 - max(0, beam.beamShortBound or 1)) - boundZone), 0)
local shortBoundTransStart = type(beam.shortBoundRange) == 'number' and max(restLen - max(0, beam.shortBoundRange), 0) or restLen * max((1 - max(0, beam.beamShortBound or 1)), 0)
local shortBoundTransEnd = type(beam.shortBoundRange) == 'number' and max(restLen - max(0, beam.shortBoundRange) - boundZone, 0) or max((restLen * max(1 - max(0, beam.beamShortBound or 1)) - boundZone), 0)
local shortBoundTransStart = type(beam.shortBoundRange) == 'number' and max(restLen - max(0, beam.shortBoundRange), 0) or restLen * max((1 - max(0, beam.beamShortBound or 1)), 0)
local longBoundTransStart = type(beam.longBoundRange) == 'number' and restLen + max(0, beam.longBoundRange) or restLen * (1 + max(0, beam.beamLongBound or 1))
local longBoundTransEnd = type(beam.longBoundRange) == 'number' and max(restLen + max(0, beam.longBoundRange) + boundZone, 0) or max((restLen * (1 + max(0, beam.beamLongBound or 1)) + boundZone), 0)
local longBoundTransStart = type(beam.longBoundRange) == 'number' and restLen + max(0, beam.longBoundRange) or restLen * (1 + max(0, beam.beamLongBound or 1))
local longBoundTransEnd = type(beam.longBoundRange) == 'number' and max(restLen + max(0, beam.longBoundRange) + boundZone, 0) or max((restLen * (1 + max(0, beam.beamLongBound or 1)) + boundZone), 0)
local longBoundHalfLen = type(beam.beamLongExtent) == 'number' and (restLen + max(0, beam.beamLongExtent)) * 0.5 or restLen * (1 + max(0, beam.beamLongBound or 1)) * 0.5
for k, v in pairs(M.state.vehicle) do
if type(v) ~= "table" and v ~= M.initState.vehicle[k] and M.state.vehicleDebugVisible then
--lastTime = os.clock()
for k, v in pairs(M.state.vehicle) do
if type(v) ~= "table" and v ~= M.initState.vehicle[k] then
M.state.vehicleDebugVisible = true
@/lua/ge/extensions/gameplay/crawl/saveSystem.lua
if data.nodes and type(data.nodes) == 'table' then
for i, n in ipairs(data.nodes) do
if n.rotation then
if type(n.rotation) == 'table' and #n.rotation == 4 then
node.rotation = quat(n.rotation[1], n.rotation[2], n.rotation[3], n.rotation[4])
node.rotation = quat(n.rotation[1], n.rotation[2], n.rotation[3], n.rotation[4])
elseif type(n.rotation) == 'table' then
node.rotation = quat(n.rotation.x or 0, n.rotation.y or 0, n.rotation.z or 0, n.rotation.w or 1)