File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -1725,6 +1725,12 @@ function bint:__tostring()
1725
1725
return self :tobase (10 )
1726
1726
end
1727
1727
1728
+ --- Convert a bint to a string when concatenating it to an other string.
1729
+ -- @see bint.tostring
1730
+ function bint .__concat (a , b )
1731
+ return tostring (a ) .. tostring (b )
1732
+ end
1733
+
1728
1734
-- Allow creating bints by calling bint itself
1729
1735
setmetatable (bint , {
1730
1736
__call = function (_ , x )
Original file line number Diff line number Diff line change @@ -105,6 +105,10 @@ local function test(bits, wordbits)
105
105
assert (bint .frombase (' AAAAAAAAAAAAAAAAAAA' ) == nil )
106
106
assert (bint .frombase (' AAAAAAAAAAAAAAAAAAA_' ) == nil )
107
107
108
+ assert (bint (9592924 ) .. ' _MyString' == ' 9592924_MyString' )
109
+ assert (' MyString_' .. bint (9592924 ) == ' MyString_9592924' )
110
+ assert (' MyString_' .. bint (9592924 ) .. " _MyString" == ' MyString_9592924_MyString' )
111
+
108
112
assert (bint .fromstring (1 ) == nil )
109
113
assert (bint .eq (bint .fromstring (' 0xff' ), 0xff ))
110
114
assert (bint .eq (bint .fromstring (' +0xff' ), 0xff ))
You can’t perform that action at this time.
0 commit comments