lua-users home
lua-l archive

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



On Jan 29, 2007, at 12:31, Thomas Hafner wrote:

Is there a standard library, where code like that belongs to? (I think
it's Ok, that it isn't part of the *language* itself, so the language
keeps being tiny.) What a pitty, if not: then every developer performs
the same tasks in a different way and no glue code can be easily
exchanged/shared among developers. Just: take it all or nothing.

Yes, rolling your own is the style of the house:

local function Copy( aValue )
        if type( aValue ) == "table" then
                local aCopy = {}

                for aKey, aValue in pairs( aValue ) do
                        aCopy[ Copy( aKey ) ] = Copy( aValue )
                end

                aValue = aCopy
        end

        return aValue
end

But... as both Manel and Doug have pointed out, there are many resources for you to peruse for inspiration:

http://lua-users.org/wiki/StandardLibraries

http://sano.luaforge.net/

etc...

Lua is a bit like an, hmmm, "auberge espagnole"... you get mostly what you bring in... :P