lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, Jan 26, 2022 at 1:09 PM Tomas Mudrunka wrote:
Also it seems it would make sense to keep the syntax symmetric. eg.:

0xFF and 0b11111111
rather than
0xFF and b'11111111'

setmetatable(_G, {__index = function(_,k) if type(k) == "string"
and k:match"^Ob[01]+$" then return tonumber(k:sub(3), 2) end end})

print(Ob11111111)  --> 255

The first character is not a zero  ;-)