[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Accessing "external" tables from within LuaExpat callbacks
- From: Michael Bauroth <Michael.Bauroth@...>
- Date: Mon, 20 Apr 2009 12:38:09 +0200
Hi,
I used a simple example from LuaExpat (something like this):
local lom = require "lxp"
plugin = {}
function cb( tag, attribute, value )
plugin[ attribute ] = value
end
local callbacks = {
StartElement = function( parser, name, attributes )
for _, attribute in pairs( attributes ) do
cb( name, attribute, attributes[ attribute ] )
end
end,
EndElement = function( parser, name ) end,
CharacterData = false
}
local xml_file = "info.plist"
local parser = lxp.new( callbacks )
local file = assert( io.open( xml_file, "r" ) )
parser:parse( file:read( "*all" ) )
file:close();
collectgarbage()
parser:parse()
parser:close()
Everytime I try to modify a table in the referenced method "cb", the
application stops with an accessviolation. What I'm doing wrong?
Best Regards
Micha