lua-users home
lua-l archive

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




On 14/07/16 02:29 PM, Luiz Henrique de Figueiredo wrote:
To put it simply, it lets you use bigints as table keys as if they
were plain lua ints or floats. E.g.

local b1 = require("bigint").one
local i = 1
local f = 1.0
local t = {"one"}

print(t[b1], t[i], t[f]) --> one one one
print(type(b1), math.type(i), math.type(f)) --> userdata integer float
This should be easy to do using a proxy table with an appropriate __index.

But that's opt-in, which means you can't pass the bigint into code you don't control.

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.