Module:MetatableTest

From Wikipedia

Documentation for this module may be created at Module:MetatableTest/doc

t = {};

mt = {}
mt.__len = function( t )
    return 50000;
end

function t.test( frame )
    local a = { 1,2,3,4,5,6 };
    local str;
    
    str = "The table has " .. #a .. " elements\n\n"; 
    
    setmetatable( a, mt );
    str = str .. "The table with metatable thinks it has " .. #a .. " elements\n\n"; 
    
    return str;
end

return t;