On Sun, Jul 14, 2013 at 4:55 PM, John Hind <[email protected]> wrote:
local x = 0b1001_0001 - support of underscores here is particularly useful
to break long bitmaps into fields - they're just for documentation and get
ignored).
This is cool; there are two ways to get this with existing Lua. One, define a memoized conversion function 'b' and then you can write b'1001_0001' to represent binary patterns. Two, hook into current environment with __newindex and convert globals looking like b1001_0001. (Implementation left as exercise)