[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: qOOP - Quick Object Oriented Programming
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 30 Mar 2012 15:03:40 +0200
On Fri, Mar 30, 2012 at 2:59 PM, Ousmane Roland Yonaba
<roland.yonaba@gmail.com> wrote:
> explaining...You're taking about the speed issue that will certainly
> occur.. Would you mind giving me an example of the reverse lookup you
> were talking about ?
We have a table
T = {dog = 1, cat = 4, lizard = 6}
and the reverse lookup is just:
R = {[1] = 'dog', [4] = 'cat', [6] = 'lizard'}
Some people call this the 'invert' operation:
function invert(t)
local res = {}
for k,v in pairs(t) do
res[v] = k
end
return res
end
steve d.