Hi,
I'm trying to find a hash map for Lua that can be indexed by a tuple. I thought I had found it in sano but there seems to be something wrong with the code that is online -- I'm getting errors if I run it in lua or luajit (the offending function[1] is below)
So any suggestions for alternatives and/or suggestions to fix sano would be most welcome :)
Thanks!
--Sid
[1] local function memoizedKnownArgs(func, numArgs)
local results = {}
if numArgs == 1 then
return function(...)
local t = results[arg[1endlongstringliteral
if t == nil then
t = func(arg[1])
results[arg[1endlongstringliteral = t
end
return t
end
else
error("only works for memoizing 1 param functions")
end
end