T
Size: a a a
T
CP
CP
VM
VM
VM
VM
S
VM
S
VM
VM
VM
function tobin(num,size)
bits = size or math.max(1, select(2, math.frexp(num)))
local t = {}
for b = bits, 1, -1 do
t[b] = math.fmod(num, 2)
num = math.floor((num - t[b]) / 2)
end
return table.concat(t)
end
S
...S
res = string.gsub(
str,
'.',
function(c) return tobin(c:byte) end
)ᴠ
function tobin(num,size)
bits = size or math.max(1, select(2, math.frexp(num)))
local t = {}
for b = bits, 1, -1 do
t[b] = math.fmod(num, 2)
num = math.floor((num - t[b]) / 2)
end
return table.concat(t)
end
VM
ᴠ
ᴠ
S