byte
Definition
-- @/=[C]:-1
function byte(...)
Callers
@/lua/common/graphpath.lua
for i = 1, #lanes, 1 do
if lanes:byte(i) == dir then
lanesN = lanesN + 1
for i = 1, lanesN, 1 do
if edge.lanes:byte(i) == 43 then inDirLanesN = inDirLanesN + 1 end
end
@/lua/vehicle/powertrain.lua
local delim = "_" --underscore is used as the delim (eg "deformGroups_turbo")
if string.byte(k, 13) == 58 then --backwards compat for using : instead of _ for the delim
delim = ":"
@/lua/common/libs/lunajson/lunajson/encoder.lua
__index = function(_, c)
return format('\\u00%02X', byte(c))
end
@/lua/common/jbeam/tableSchema.lua
if string.byte(val, 1) == 124 then -- |
local parts = split(val, "|", 999)
@/lua/ge/extensions/ui/console.lua
local ord = string.byte( str, i )
hex = hex .. string.format( "%02x ", ord )
@/lua/ge/extensions/editor/slotTrafficEditor.lua
local offset1 = getLaneOffset(cp1, cp2, math.min(inNodeRad, outNodeRad) * 2, laneIdx, laneCount)
local laneDir = road.properties.lanes:byte(laneIdx) == 43 -- '+'
color = laneDir and laneColor2 or laneColor1
@/lua/common/utils.lua
counter = fmod(counter * 8161, 4294967279) +
(string.byte(text, i) * 16776193) +
((string.byte(text, i + 1) or (len - i + 256)) * 8372226) +
(string.byte(text, i) * 16776193) +
((string.byte(text, i + 1) or (len - i + 256)) * 8372226) +
((string.byte(text, i + 2) or (len - i + 256)) * 3932164)
((string.byte(text, i + 1) or (len - i + 256)) * 8372226) +
((string.byte(text, i + 2) or (len - i + 256)) * 3932164)
end
for i = 1, #s do
local c = byte(s, i)
if c < 32 or c == 34 or c == 92 then
local ord = string.byte(str, i)
hex = hex .. string.format("%02x ", ord)
@/lua/common/csvlib.lua
local function newXSV(delim, ...)
local self = setmetatable({buf = buffer.new(), linedelim = "", delim = delim, delimnum = byte(delim, 1)}, csvWriter)
local headercount = select('#', ...)
local delimnum = self.delimnum
local c = byte(v, 1)
if c == nil or c <= 32 or c == delimnum or c == 34 then -- space sep "
for i1 = 2, #v do
local c = byte(v, i1)
if c == delimnum or c == 34 or c == 13 or c == 10 then -- sep " CR LF
if s == nil then return nil end
sep = sep and byte(sep) or 44 -- ,
local res, resi, lineLen, li, c, i = {}, 1, 1, 1, 0, 1
while true do
c = byte(s, i)
while c == 32 or c == 9 do -- space tab
while c == 32 or c == 9 do -- space tab
i = i + 1; c = byte(s, i)
end
repeat
i = i + 1; c = byte(s, i)
if c == 34 and byte(s, i + 1) == 34 then -- "
i = i + 1; c = byte(s, i)
if c == 34 and byte(s, i + 1) == 34 then -- "
i = i + 2; c = byte(s, i)
if c == 34 and byte(s, i + 1) == 34 then -- "
i = i + 2; c = byte(s, i)
end
end
until (c == 34 and byte(s, i+1) ~= 34) or c == nil -- "
val = sub(s, si+1, i - 1):gsub('""', '"')
val = sub(s, si+1, i - 1):gsub('""', '"')
repeat i=i+1; c = byte(s,i) until c~=32 and c~=9 -- space tab
else
while c ~= sep and c ~= 13 and c ~= 10 and c ~= nil do -- sep CR LF
i = i + 1; c = byte(s, i)
end
else
c = byte(s, i)
res[resi] = line
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
-- binstr = ffi.string(vertices) --dataString:get())
-- print('?? CHAR:'..string.byte(binstr, 3)) -- string.len(binstr)))
-- print('?? CHAR:'..string.char(string.byte(binstr, 1, 100))) -- string.len(binstr)))
-- print('?? CHAR:'..string.byte(binstr, 3)) -- string.len(binstr)))
-- print('?? CHAR:'..string.char(string.byte(binstr, 1, 100))) -- string.len(binstr)))
-- local s = dataString:tostring()
@/lua/common/jsonPrettyEncoderCustom.lua
for i = 1, #s do
local c = string.byte(s, i)
if c < 32 or c == 34 or c == 92 then
@/lua/ge/extensions/editor/trafficManager.lua
spawnPos:set(((lane - 0.5) * laneWidth - radius) * push3(lateralDirVec) + spawnPos) -- spawn position
p2p1DirVec:setScaled((lanes:byte(lane) == 43 and 1 or -1)) -- spawn direction
-- return spawn position, spawn direction, and true flag as lanes exist and spawning is on a lane
@/lua/common/lpack.lua
i = i or 1
local b8, b7, b6, b5, b4, b3, b2, b1 = str:byte(i, i+7)
local expo = (b1%0x80)*0x10 + floor(b2*0.0625)
local i, r = seridx + 1, 0
local c = byte(s, i)
while c >= 48 and c <= 57 do -- \d
i, r = i + 1, (c - 48) + r * 10
c = byte(s, i)
end
i = i + 1
c = byte(s, i)
local f = 0
i, f = i + 1, f + (c - 48) * scale
c = byte(s, i)
scale = scale * 0.1
i = i + 2 -- skip e+-
c = byte(s, i)
while c >= 48 and c <= 57 do -- \d
i = i + 1
c = byte(s, i)
end
i = i + 1
local r, c = 0, byte(s, i)
while c >= 48 and c <= 57 do -- \d
while c >= 48 and c <= 57 do -- \d
i = i + 1; r = r * 10 + (c - 48); c = byte(s, i)
end
local i1 = i + 1
local b1, b2 = byte(s, i, i1)
local numlen, strlen = b1 - 65, b2 - 48
for i1 = 1, numlen do
strlen = (byte(s, i + i1) - 48) + strlen * 10
end
seridx = strs + strlen
return sub(s, strs, seridx-1), byte(s, seridx), seridx
end
local function peekDecBin()
local c = byte(bufDec:get(1))
if c <= 250 then -- table
s = is
if byte(is, 1) == 98 then -- b
bufDec:set(is):get(1)
else
res = peekDec[byte(is, 2)](2)
end
seridx = seridx + 1
key, c, seridx = peek[byte(s, seridx)](seridx)
res[key], c, seridx = peek[c](seridx)
seridx = seridx + 1
return true, byte(s, seridx), seridx
end
seridx = seridx + 1
return false, byte(s, seridx), seridx
end
local x, y, z, c
x, c, seridx = peekDec[byte(s, seridx)](seridx)
y, c, seridx = peekDec[c](seridx)
local x, y, z, w, c
x, c, seridx = peekDec[byte(s, seridx)](seridx)
y, c, seridx = peekDec[c](seridx)
seridx = seridx + 1
return '?', byte(s, seridx), seridx
end
@/lua/common/jbeam/utils.lua
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
-- check for "nodeRotate##"
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
-- check for "nodeRotate##"
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
-- check for "nodeRotate##"
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
-- check for "nodeRotate##"
-- check for "nodeRotate##"
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeRotate##"
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeRotate##"
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeRotate##"
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeRotate##"
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeRotate##"
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
idx1 = idx1 ~= nil and idx1 - 48 or 0
if byte(nodeKey,10)==101 and byte(nodeKey,9)==116 and byte(nodeKey,8)==97 and byte(nodeKey,7)==116 and byte(nodeKey,6)==111 and byte(nodeKey,5)==82 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
idx1 = idx1 ~= nil and idx1 - 48 or 0
-- check for "nodeOffset##", ignoring offset if jbeamData.ignoreNodeOffset
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeOffset##", ignoring offset if jbeamData.ignoreNodeOffset
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeOffset##", ignoring offset if jbeamData.ignoreNodeOffset
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeOffset##", ignoring offset if jbeamData.ignoreNodeOffset
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeOffset##", ignoring offset if jbeamData.ignoreNodeOffset
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
-- check for "nodeOffset##", ignoring offset if jbeamData.ignoreNodeOffset
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
idx1 = idx1 ~= nil and idx1 - 48 or 0
elseif not jbeamData.ignoreNodeOffset and byte(nodeKey,10)==116 and byte(nodeKey,9)==101 and byte(nodeKey,8)==115 and byte(nodeKey,7)==102 and byte(nodeKey,6)==102 and byte(nodeKey,5)==79 then
local idx1, idx2 = byte(nodeKey,11), byte(nodeKey,12)
idx1 = idx1 ~= nil and idx1 - 48 or 0
-- check for "nodeMove##"
elseif byte(nodeKey,8)==101 and byte(nodeKey,7)==118 and byte(nodeKey,6)==111 and byte(nodeKey,5)==77 then
local idx1, idx2 = byte(nodeKey,9), byte(nodeKey,10)
-- check for "nodeMove##"
elseif byte(nodeKey,8)==101 and byte(nodeKey,7)==118 and byte(nodeKey,6)==111 and byte(nodeKey,5)==77 then
local idx1, idx2 = byte(nodeKey,9), byte(nodeKey,10)
-- check for "nodeMove##"
elseif byte(nodeKey,8)==101 and byte(nodeKey,7)==118 and byte(nodeKey,6)==111 and byte(nodeKey,5)==77 then
local idx1, idx2 = byte(nodeKey,9), byte(nodeKey,10)
-- check for "nodeMove##"
elseif byte(nodeKey,8)==101 and byte(nodeKey,7)==118 and byte(nodeKey,6)==111 and byte(nodeKey,5)==77 then
local idx1, idx2 = byte(nodeKey,9), byte(nodeKey,10)
elseif byte(nodeKey,8)==101 and byte(nodeKey,7)==118 and byte(nodeKey,6)==111 and byte(nodeKey,5)==77 then
local idx1, idx2 = byte(nodeKey,9), byte(nodeKey,10)
idx1 = idx1 ~= nil and idx1 - 48 or 0
elseif byte(nodeKey,8)==101 and byte(nodeKey,7)==118 and byte(nodeKey,6)==111 and byte(nodeKey,5)==77 then
local idx1, idx2 = byte(nodeKey,9), byte(nodeKey,10)
idx1 = idx1 ~= nil and idx1 - 48 or 0
@/lua/common/libs/lua-MessagePack/MessagePack.lua
local function hexadump(s)
return (s:gsub('.', function (c) return format('%02X ', c:byte()) end))
end
end
local val = s:byte(i)
c.i = i+1
end
local b1, b2, b3, b4 = s:byte(i, i+3)
local sign = b1 > 0x7F and -1 or 1
end
local b1, b2, b3, b4, b5, b6, b7, b8 = s:byte(i, i+7)
local sign = b1 > 0x7F and -1 or 1
c.i = i+1
return s:byte(i)
end
end
local b1, b2 = s:byte(i, i+1)
c.i = i+2
c.i = i+4
local b1, b2, b3, b4 = s:byte(i, i+3)
return ((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4
end
local b1, b2, b3, b4, b5, b6, b7, b8 = s:byte(i, i+7)
c.i = i+8
end
local b1 = s:byte(i)
c.i = i+1
end
local b1, b2 = s:byte(i, i+1)
c.i = i+2
end
local b1, b2, b3, b4 = s:byte(i, i+3)
c.i = i+4
end
local b1, b2, b3, b4, b5, b6, b7, b8 = s:byte(i, i+7)
c.i = i+8
@/lua/common/libs/lunajson/lunajson/decoder.lua
if byte(num) ~= 0x2E or byte(num, -1) == 0x2E then
number_error()
if byte(num) ~= 0x2E or byte(num, -1) == 0x2E then
number_error()
local num, c = match(json, '^([0-9]+%.?[0-9]*)([-+.A-Za-z]?)', pos)
if byte(num, -1) == 0x2E then -- error if ended with period
number_error()
local function f_mns()
local c = byte(json, pos)
if c then
if ch == 'u' then
local c1, c2, c3, c4, rest = byte(ucode, 1, 5)
ucode = f_str_hextbl[c1-47] * 0x1000 +
newpos = newpos+1
c1, c2 = byte(json, tmppos-1, tmppos)
if c2 == 0x5C and c1 == 0x5C then -- skip preceding '\\'s
tmppos = tmppos-2
c1, c2 = byte(json, tmppos-1, tmppos)
until c2 ~= 0x5C or c1 ~= 0x5C
local i = 0
if byte(json, pos) == 0x5D then -- check closing bracket ']' which means the array empty
pos = pos+1
i = i+1
f = dispatcher[byte(json,newpos)] -- parse value
pos = newpos+1
pos = match(json, '^[ \n\r\t]*()', pos)
if byte(json, pos) == 0x7D then -- check closing bracket '}' which means the object empty
pos = pos+1
repeat
if byte(json, newpos) ~= 0x22 then -- check '"'
decode_error("not key")
f = f_err
local c1, c2, c3 = byte(json, pos, pos+3)
if c1 == 0x3A then
end
f = dispatcher[byte(json, newpos)]
newpos = newpos+1
f = dispatcher[byte(json, pos)]
pos = pos+1
@/lua/common/libs/luaqrcode/qrencode.lua
if #a == 2 then
b1 = asciitbl[string.byte(string.sub(a,1,1))]
b2 = asciitbl[string.byte(string.sub(a,2,2))]
b1 = asciitbl[string.byte(string.sub(a,1,1))]
b2 = asciitbl[string.byte(string.sub(a,2,2))]
int = b1 * 45 + b2
else
int = asciitbl[string.byte(a)]
bitstring = bitstring .. binary(int,6)
string.gsub(str,".",function(x)
ret[#ret + 1] = binary(string.byte(x),8)
end)
@/lua/common/libs/lua-websockets/websocket/tools.lua
pos = pos or 1
return pos+n, string.byte(str, pos, pos + n - 1)
end
@/lua/common/luaBinding.lua
-- search for SimObject's metatables
if k:byte(1) == 100 and classtable.isSubClassOf then -- d
flattenObjectMetatable(classtable)
rawset(plainGetters, f, getter)
if string.byte(f, 1) ~= 95 then
rawset(v, f, nil)
@/lua/common/libs/resty/template.lua
view = template.load(view)
if byte(view, 1, 1) == 27 then return view end
end
@/lua/ge/extensions/c2/panelPlugins/tileManager.lua
local offset = getLaneOffset(minRadius * 2, i, laneCount)
local laneDir = link.lanes:byte(i) == 43 -- '+'
local color = laneDir and laneColor2 or laneColor1
@/lua/common/libs/lunajson/lunajson/sax.lua
local function tryc()
local c = byte(json, pos)
if not c then
jsonnxt()
c = byte(json, pos)
end
local c = tellc()
if byte(target, i) ~= c then
parse_error("invalid char")
local c = byte(json, pos)
pos = pos+1
if byte(num) ~= 0x2E or byte(num, -1) == 0x2E then
pos = pos-1
if byte(num) ~= 0x2E or byte(num, -1) == 0x2E then
pos = pos-1
local num, c = match(json, '^([0-9]+%.?[0-9]*)([-+.A-Za-z]?)', pos)
if byte(num, -1) == 0x2E then -- error if ended with period
return generic_number(mns)
local function f_mns()
local c = byte(json, pos) or tellc()
if c then
if ch == 'u' then
local c1, c2, c3, c4, rest = byte(ucode, 1, 5)
ucode = f_str_hextbl[c1-47] * 0x1000 +
end
if byte(json, newpos) == 0x22 then -- break if '"'
break
spaces()
if byte(json, pos) == 0x5D then -- check closing bracket ']' which means the array empty
pos = pos+1
while true do
f = dispatcher[byte(json, pos)] -- parse value
pos = pos+1
spaces() -- since the current chunk can be ended, skip spaces toward following chunks
local c = byte(json, pos)
pos = pos+1
spaces()
if byte(json, pos) == 0x7D then -- check closing bracket '}' which means the object empty
pos = pos+1
while true do
if byte(json, pos) ~= 0x22 then
parse_error("not key")
spaces() -- read spaces through chunks
if byte(json, pos) ~= 0x3A then -- check colon again
parse_error("no colon after a key")
end
f = dispatcher[byte(json, pos)]
pos = pos+1
spaces() -- read spaces through chunks
local c = byte(json, pos)
pos = pos+1
spaces()
f = dispatcher[byte(json, pos)]
pos = pos+1
@/lua/common/json.lua
local function readNumber(si)
local c, i, r = byte(s, si), si, 0
while c >= 48 and c <= 57 do -- \d
i, r = i + 1, r * 10 + (c - 48)
c = byte(s, i)
end
i = i + 1
c = byte(s, i)
local f, scale = 0, 0.1
i, f = i + 1, f + (c - 48) * scale
c = byte(s, i)
scale = scale * 0.1
else
local pm = byte(s, si - 1)
jsonError(string.format("Invalid number: '%s'", sub(s, si - ((pm == 45 or pm == 43) and 1 or 0), infend)), si)
i = i + 1
c = byte(s, i)
while (c >= 45 and c <= 57) or c == 43 do -- \d-+
i = i + 1
c = byte(s, i)
end
if r == nil then
local pm = byte(s, si - 1)
jsonError(string.format("Invalid number: '%s'", sub(s, si - ((pm == 45 or pm == 43) and 1 or 0), i-1)), si)
local si1 = si + 1 -- "
local ch, i = byte(s, si1), si + 2
while ch ~= 34 and ch ~= 92 and ch ~= nil do -- " \
while ch ~= 34 and ch ~= 92 and ch ~= nil do -- " \
ch = byte(s, i)
i = i + 1
i = si1
ch = byte(s, i)
while ch ~= 34 do -- "
resultidx = resultidx + 1
ch = byte(s, i)
if ch == 92 then -- \
if ch == 92 then -- \
local ch1 = escapes[byte(s, i+1)]
if ch1 then
::restart::
local c = byte(s, i)
if c == 47 then -- / -- single line comment "//"
i = i + 1
c = byte(s, i)
until c == 10 or c == 13 or c == nil
i = i + 1
c = byte(s, i)
if c == 42 then
if c == 42 then
if byte(s, i+1) == 47 then -- */
break
break
elseif byte(s, i-1) == 47 then -- /*
jsonError("'/*' inside another '/*' comment is not permitted", i)
repeat
c = byte(s, i); i = i + 1
until (c == nil or c > 32) and c ~= 44 -- matches space tab newline or comma
local function skipWhiteSpace(i)
local c = byte(s, i); i = i + 1
while (c ~= nil and c <= 32) or c == 44 do -- matches space tab newline or comma
while (c ~= nil and c <= 32) or c == 44 do -- matches space tab newline or comma
c = byte(s, i); i = i + 1
end
i = si
local ch = byte(s, i)
while ch ~= nil and ((ch >= 97 and ch <= 122) or (ch >= 65 and ch <= 90) or (ch >= 48 and ch <= 57) or ch == 95) do -- [a z] [A Z] or [0 9] or _
i = i + 1
ch = byte(s, i)
end
repeat
c = byte(s, i); i = i + 1
until (c == nil or c > 32) and c ~= 44 -- matches space tab newline or comma
peekTable[73] = function(si) -- I
local c1,c2,c3,c4,c5,c6,c7 = byte(s, si+1, si+7)
if c1==110 and c2==102 and c3==105 and c4==110 and c5==105 and c6==116 and c7==121 then -- nfinity
repeat -- skipWhiteSpace
c = byte(s, i); i = i + 1
until (c == nil or c > 32) and c ~= 44 -- matches space tab newline or comma
repeat -- skipWhiteSpace
c = byte(s, i); i = i + 1
until c ~= 44 and (c == nil or c > 32) -- matches space tab newline or comma
peekTable[116] = function(si) -- t
local b1, b2, b3 = byte(s, si+1, si+3)
if b1 == 114 and b2 == 117 and b3 == 101 then -- rue
peekTable[102] = function(si) -- f
local b1, b2, b3, b4 = byte(s, si+1, si+4)
if b1 == 97 and b2 == 108 and b3 == 115 and b4 == 101 then -- alse
peekTable[110] = function(si) -- n
local b1, b2, b3 = byte(s, si+1, si+3)
if b1 == 117 and b2 == 108 and b3 == 108 then -- ull
repeat -- skipWhiteSpace
c = byte(s, i); i = i + 1
until c ~= 44 and (c == nil or c > 32) -- matches space tab newline or comma
local num
if byte(s, si) == 73 then -- I
num, si = peekTable[73](si)
@/lua/vehicle/controller/tech/roadsSensor.lua
for i = #lanes, 1, -1 do
local char = lanes:byte(i) == 43 and '-' or lanes:byte(i) == 45 and '+' or '0'
res = res..char
for i = #lanes, 1, -1 do
local char = lanes:byte(i) == 43 and '-' or lanes:byte(i) == 45 and '+' or '0'
res = res..char
for i = 1, #lanes, 1 do
if lanes:byte(i) == dir then
lanesN = lanesN + 1
@/lua/common/utils/interactiveShell.lua
-- some shortcuts
local cc = string.byte(cmd)
if cc == 4 or cmd == "exit" or cmd == "quit" then
@/lua/common/jsonDebug.lua
local function readNumber(si)
local c, i, r = byte(s, si), si, 0
while c >= 48 and c <= 57 do -- \d
i, r = i + 1, r * 10 + (c - 48)
c = byte(s, i)
end
i = i + 1
c = byte(s, i)
local f, scale = 0, 0.1
i, f = i + 1, f + (c - 48) * scale
c = byte(s, i)
scale = scale * 0.1
else
local pm = byte(s, si - 1)
jsonError(string.format("Invalid number: '%s'", sub(s, si - ((pm == 45 or pm == 43) and 1 or 0), infend)), si)
i = i + 1
c = byte(s, i)
while (c >= 45 and c <= 57) or c == 43 do -- \d-+
i = i + 1
c = byte(s, i)
end
if r == nil then
local pm = byte(s, si - 1)
jsonError(string.format("Invalid number: '%s'", sub(s, si - ((pm == 45 or pm == 43) and 1 or 0), i-1)), si)
local si1 = si + 1 -- "
local ch, i = byte(s, si1), si + 2
while ch ~= 34 and ch ~= 92 and ch ~= nil do -- " \
while ch ~= 34 and ch ~= 92 and ch ~= nil do -- " \
ch = byte(s, i)
i = i + 1
i = si1
ch = byte(s, i)
while ch ~= 34 do -- "
resultidx = resultidx + 1
ch = byte(s, i)
if ch == 92 then -- \
if ch == 92 then -- \
local ch1 = escapes[byte(s, i+1)]
if ch1 then
::restart::
local c = byte(s, i)
if c == 47 then -- / -- single line comment "//"
i = i + 1
c = byte(s, i)
until c == 10 or c == 13 or c == nil
i = i + 1
c = byte(s, i)
if c == 42 then
if c == 42 then
if byte(s, i+1) == 47 then -- */
break
break
elseif byte(s, i-1) == 47 then -- /*
jsonError("'/*' inside another '/*' comment is not permitted", i)
repeat
c = byte(s, i); i = i + 1
until (c == nil or c > 32) and c ~= 44 -- matches space tab newline or comma
local function skipWhiteSpace(i)
local c = byte(s, i); i = i + 1
while (c ~= nil and c <= 32) or c == 44 do -- matches space tab newline or comma
while (c ~= nil and c <= 32) or c == 44 do -- matches space tab newline or comma
c = byte(s, i); i = i + 1
end
i = si
local ch = byte(s, i)
while ch ~= nil and ((ch >= 97 and ch <= 122) or (ch >= 65 and ch <= 90) or (ch >= 48 and ch <= 57) or ch == 95) do -- [a z] [A Z] or [0 9] or _
i = i + 1
ch = byte(s, i)
end
repeat
c = byte(s, i); i = i + 1
until (c == nil or c > 32) and c ~= 44 -- matches space tab newline or comma
peekTable[73] = function(si) -- I
local c1,c2,c3,c4,c5,c6,c7 = byte(s, si+1, si+7)
if c1==110 and c2==102 and c3==105 and c4==110 and c5==105 and c6==116 and c7==121 then -- nfinity
repeat -- skipWhiteSpace
c = byte(s, i); i = i + 1
until (c == nil or c > 32) and c ~= 44 -- matches space tab newline or comma
repeat -- skipWhiteSpace
c = byte(s, i); i = i + 1
until c ~= 44 and (c == nil or c > 32) -- matches space tab newline or comma
peekTable[116] = function(si) -- t
local b1, b2, b3 = byte(s, si+1, si+3)
if b1 == 114 and b2 == 117 and b3 == 101 then -- rue
peekTable[102] = function(si) -- f
local b1, b2, b3, b4 = byte(s, si+1, si+4)
if b1 == 97 and b2 == 108 and b3 == 115 and b4 == 101 then -- alse
peekTable[110] = function(si) -- n
local b1, b2, b3 = byte(s, si+1, si+3)
if b1 == 117 and b2 == 108 and b3 == 108 then -- ull
repeat -- skipWhiteSpace
c = byte(s, i); i = i + 1
until c ~= 44 and (c == nil or c > 32) -- matches space tab newline or comma
local num
if byte(s, si) == 73 then -- I
num, si = peekTable[73](si)
@/lua/common/libs/xlsxlib/xlsxlib.lua
for i = 1, #col do
local char = col:sub(i, i):byte()
if char < 65 or char > 90 then
@/lua/common/jbeamWriter.lua
for i = 1, #s do
local c = byte(s, i)
if c < 32 or c == 34 or c == 92 then
@/lua/common/jit/p.lua
for _, file in ipairs(files) do
local f0 = file:byte()
if f0 == 40 or f0 == 91 then
for line in fp:lines() do
if line:byte() == 27 then
out:write("[Cannot annotate bytecode file]\n")
@/lua/ge/map.lua
for i = #lanes, 1, -1 do
laneStringBuffer:put(lanes:byte(i) == 43 and '-' or lanes:byte(i) == 45 and '+' or '0')
end
for i = #lanes, 1, -1 do
laneStringBuffer:put(lanes:byte(i) == 43 and '-' or lanes:byte(i) == 45 and '+' or '0')
end
oneWay = isOneWay(lanes)
if oneWay and lanes:byte(1) == 45 then --> 45 is ascii code for '-'
lanes = flipLanes(lanes)
oneWay = isOneWay(lanes)
if oneWay and lanes:byte(1) == 45 then --> 45 is ascii code for '-'
lanes = flipLanes(lanes)
for i = 1, #str do
res = res + str:byte(i)
end
local offset1 = getLaneOffset(edgeData.inNode, edgeData.outNode, min(edgeData.inRadius, edgeData.outRadius) * 2, i, laneCount)
local laneDir = edgeData.lanes:byte(i) == 43 --> ascii code for '+'
local color = laneDir and laneColor2 or laneColor1
local offset1 = getLaneOffset(edgeData.inNode, edgeData.outNode, minRadius * 2, i, laneCount)
local laneDir = edgeData.lanes:byte(i) == 43 --> ascii code for '+'
local color = laneDir and laneColor2 or laneColor1
@/ui/entrypoints/main/perfrunner.js
lines.push(`- avg_ttfb_ms: ${to3(summary.avgTtfbMs)} — average time until the server starts replying`);
lines.push(`- p50_ttfb_ms: ${to3(summary.p50TtfbMs)} — median time to first byte (half faster, half slower)`);
lines.push(`- min_ttfb_ms: ${to3(summary.minTtfbMs)}, max_ttfb_ms: ${to3(summary.maxTtfbMs)}`);
@/lua/common/libs/LuaIRC/util.lua
local randchar = sub(nick, randindex, randindex)
local b = byte(randchar)
b = b + 1
@/lua/vehicle/ai.lua
for i = #lanes, 1, -1 do
laneStringBuffer:put(lanes:byte(i) == 43 and '-' or lanes:byte(i) == 45 and '+' or '0')
end
for i = #lanes, 1, -1 do
laneStringBuffer:put(lanes:byte(i) == 43 and '-' or lanes:byte(i) == 45 and '+' or '0')
end
for i = 1, #lanes, 1 do
if lanes:byte(i) == dir then
lanesN = lanesN + 1
for i = 1, numOfLanes do
if laneConfig:byte(i) == 43 then -- "+"
leftIdx = i
for i = numOfLanes, 1, -1 do
if laneConfig:byte(i) == 43 then -- "+"
rightIdx = i
for i = lane-1, 1, -1 do
if laneConfig:byte(i) == 43 then -- "+"
leftIdx = i
for i = lane+1, numOfLanes do
if laneConfig:byte(i) == 43 then -- "+"
rightIdx = i
local overlapError = laneWidth - max(0, min(thisLaneLimRight, laneRightLimLatPos) - max(thisLaneLimLeft, laneLeftLimLatPos))
local directionError = laneConfig:byte(i) == 43 and 0 or 1
@/lua/ge/extensions/tech/sensors.lua
for i = 1, #cData do
table.insert(colourData, cData:byte(i))
end
for i = 1, #aData do
table.insert(annotationData, aData:byte(i))
end
for i = 1, #dData, 4 do
table.insert(depthData, unpack_float(dData:byte(i), dData:byte(i + 1), dData:byte(i + 2), dData:byte(i + 3)))
end
for i = 1, #dData, 4 do
table.insert(depthData, unpack_float(dData:byte(i), dData:byte(i + 1), dData:byte(i + 2), dData:byte(i + 3)))
end
for i = 1, #dData, 4 do
table.insert(depthData, unpack_float(dData:byte(i), dData:byte(i + 1), dData:byte(i + 2), dData:byte(i + 3)))
end
for i = 1, #dData, 4 do
table.insert(depthData, unpack_float(dData:byte(i), dData:byte(i + 1), dData:byte(i + 2), dData:byte(i + 3)))
end
for i = 1, numPts, 12 do
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
for i = 1, numPts, 12 do
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
for i = 1, numPts, 12 do
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
for i = 1, numPts, 12 do
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
local x = unpack_float(pts:byte(i), pts:byte(i + 1), pts:byte(i + 2), pts:byte(i + 3))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
table.insert(pointsData, vec3(x, y, z))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
table.insert(pointsData, vec3(x, y, z))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
table.insert(pointsData, vec3(x, y, z))
local y = unpack_float(pts:byte(i + 4), pts:byte(i + 5), pts:byte(i + 6), pts:byte(i + 7))
local z = unpack_float(pts:byte(i + 8), pts:byte(i + 9), pts:byte(i + 10), pts:byte(i + 11))
table.insert(pointsData, vec3(x, y, z))
for i = 1, numColour do
table.insert(colourData, colourBinary:byte(i))
end
@/lua/common/extensions/ui/improfiler.lua
for _, file in ipairs(files) do
local f0 = file:byte()
if f0 == 40 or f0 == 91 then
for line in fp:lines() do
if line:byte() == 27 then
outString = outString .. ("[Cannot annotate bytecode file]\n")
@/lua/ge/extensions/gameplay/rally/notebook/path.lua
local letter = importIdentifiers[#importIdentifiers]
local asciiValue = string.byte(letter)
local nextAsciiValue = asciiValue + 1
@/lua/common/libs/luasec/ssl.lua
while i < #str do
local len = str:byte(i)
array[#array + 1] = str:sub(i + 1, i + len)
@/lua/common/tcpServer.lua
-- Check for null character
if message:byte(header.length) ~= 0 then
log('E', 'TCPServer', 'Message format error: Null character not found.')
@/lua/common/libs/luasocket/socket/url.lua
return (string.gsub(s, "([^A-Za-z0-9_])", function(c)
return string.format("%%%02x", string.byte(c))
end))
if segment_set[c] then return c
else return string.format("%%%02x", string.byte(c)) end
end)
@/lua/vehicle/extensions/profiling/p.lua
for _, file in ipairs(files) do
local f0 = file:byte()
if f0 == 40 or f0 == 91 then
for line in fp:lines() do
if line:byte() == 27 then
out:write("[Cannot annotate bytecode file]\n")
@/lua/common/tech/techCommunication.lua
local function unpackUnsignedInt32Network(c)
local b1, b2, b3, b4 = c:byte(1, 4)
return ((b1 * 0x100 + b2) * 0x100 + b3) * 0x100 + b4
@/lua/ge/extensions/editor/aiViz.lua
local offset1 = getLaneOffset(data.inNode, data.outNode or (data.inNode == nid and lid or nid), math.min(inNodeRad, outNodeRad) * 2, i, laneCount)
local laneDir = data.lanes:byte(i) == 43 --> ascii code for '+'
color = laneDir and laneColor2 or laneColor1