[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Holy arrays vs perfect arrays
- From: Dirk Laurie <dpl@...>
- Date: Fri, 17 Dec 2010 06:33:51 +0200
On Thu, Dec 16, 2010 at 11:23:24PM +0200, Henning Diedrich wrote:
>
> Make it "Could Lua benefit from a more useful, or maybe 'safe',
> behavior of #t for holy ts?"
^^^^^^^
I love it!
The difference between holiness and perfection:
---[[
sins = { pride=true; covetousness=true; lust=true; anger=true;
gluttony=true; envy=true; sloth=true }
for k,v in ipairs(t) do if sins[v] then t[k]=nil end end -- holiness
for i=#t,1,-1 do if sins[v[i]] then t.remove(i) end end -- perfection
--]]
Of course, you must start from an unholy array t!
Dirk