lua-users home
lua-l archive

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




On 14/07/16 02:09 PM, Dirk Laurie wrote:
2016-07-14 17:27 GMT+02:00 Soni L. <fakedme@gmail.com>:

(Empty reply so someone sees this. The table vs array threads kill all other
threads :/)
I'm not usually shy to participate but I have not been able to understand
what __key is supposed to do that lua_setuservalue and its exposure
in the  debug library can't. Could you explain that from scratch?

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

--
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.