lua-users home
lua-l archive

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



On Mar 21, 2005, at 14:40, Rici Lake wrote:

Probably. Although the issues are subtle. I don't address any of them here; this is simply a working reimplementation of the same transformation.

Excellent! Thanks :)

Now the infamous gsub() function looks something like this:

charWithEntity = function( aSymbol, anEntity )
        if ( aSymbol == "#" ) then
local aCode = tonumber( ( string.gsub( anEntity, "^x", "0x" ) ) )

                if ( ( aCode ~= nil ) and ( aCode < 256 ) ) then
                        return string.char( aCode )
                end
        else
                local aValue = thisClass.entities().get( anEntity )

                if ( aValue ~= nil ) then
                        return aValue
                end
        end

        return string.format( "&%s%s;", aSymbol, anEntity )
end

http://dev.alt.textdrive.com/file/lu/LUXMLInputStream.lua

Is that Lua-esque enough? :))

Cheers

--
PA, Onnay Equitursay
http://alt.textdrive.com/