HELP - IM DYING - attempt to index upvalue 'xml' (a function value)

This is the error I am getting - which makes no sense what so ever to me "attempt to index upvalue ‘xml’ (a function value)"

i first thought it was my attempt to create a lua sub class ( using the XML.lua as an example ), but after using code that already have in another app to load and read XML into a string, I get the same error.

The different in apps is that the one that works uses storyboard and the one that does not uses the director class.

I get the error on the 2nd line below in my director app, and im not sure why. I have tried all kinds of stuff and its killing me to figure out, if anyone can help I will owe you big time:)

local xml = require( "xml" ).newParser  
local myXML = xml:loadFile( "appdata.xml" ) --I get the error on this line  

Larry [import]uid: 11860 topic_id: 26854 reply_id: 326854[/import]

Hiya double. I think lua believes your statement xml = require( “xml” ).newParser is a function declaration/pointer, not a require statement (because of the .newParser on the end).

So, leave out the .newParser and you’ll be a little bit closer. [import]uid: 79933 topic_id: 26854 reply_id: 108997[/import]

You are not CALLING the newParser function
Change the code to
[lua]local xml = require( “xml” ).newParser()[/lua]
[import]uid: 64174 topic_id: 26854 reply_id: 109001[/import]

You know I could swear that I had the Parens() there from before, in-fact I am pretty sure I tried it both ways.

But I made that change and several others, and now I just have to ask – Have I Told You Lately, That I Love Ya’ll ?? –

Thanks so Much

Common Code module coming along nicely :slight_smile:

Larry
DoubleSlashDesign.com
[import]uid: 11860 topic_id: 26854 reply_id: 109062[/import]