lua-users home
lua-l archive

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


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