Fixed a bug in this file
bits.new(0) would not return any string back when you should have gotten 00000000 as an answer!
This commit is contained in:
parent
7b4d0a23b2
commit
e3f438c4e0
@ -95,11 +95,12 @@ function bits.new(n,s)
|
||||
end
|
||||
local str=string.reverse(table.concat(tab))
|
||||
if #str%8~=0 then
|
||||
str=string.rep('0',8-#str%8)..str
|
||||
temp.data=string.rep('0',8-(#str))..str
|
||||
elseif #str==0 then
|
||||
temp.data="00000000"
|
||||
end
|
||||
temp.data=str
|
||||
else
|
||||
temp.data=n
|
||||
temp.data=n or "00000000"
|
||||
end
|
||||
setmetatable({__tostring=function(self) return self.data end},temp)
|
||||
return temp
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user