String index from variable suddenly doesn't work

This isn’t a bug, per se; I’m almost certain it’s on my end. …but I didn’t know where else to file this. Hope you don’t mind.

I just recently moved my project to a new computer. Last night, it was working just fine. Today I made some changes (details below), and the game is behaving strangely. There may be more, but here’s what I noticed:

If I have a table with string indexes, and I call a specific entry using a variable holding that string index, it returns nil. Here’s some code:

[lua]local points = { set1 = 4, set2 = 3, set3 = 2, set4 = 1 }

print(card.set) – Returns string ‘set1’
print(points[‘set1’]) – Returns number 4
print(points[‘set2’]) – Returns number 3
print(points[‘set3’]) – Returns number 2
print(points[‘set4’]) – Returns number 1
print(points[card.set]) – Returns nil[/lua]

That’s not the exact code; I simplified a little to prove my point…but it serves its purpose. I can’t for the life of me understand what could possibly have happened.

Now, as I mentioned, I did change some things recently. This is a Mac. I’m using Build 498, but I doubt that matters…previous version exhibited the same behaviour. I just switched my Terminal from bash to zsh…also unrelated; switching back to bash didn’t affect anything. I also installed the latest XCode 4/iOS SDK. I thought this might have something to do with it. I downloaded it because I needed gcc for something, but I don’t think that would affect my Corona project…perhaps something else in there, though?

If you can think of anything else, let me know; I’ll try to remember what else I changed, but I don’t remember there being much more. Thanks in advance for your help; this one has me baffled. hehe [import]uid: 21712 topic_id: 9454 reply_id: 309454[/import]

Hmm…my confusion continues. If, for testing purposes, I use a different value than “set” (e.g. “type”, which is another–albeit unrelated–property of card), it no longer passes nil. That’s, obviously, not the property I want to use…and furthermore, it has been working up until last night. Uninstalling XCode did not fix it, and I’m out of ideas. …even tried a fresh git clone.

So, could there suddenly be something wrong with using the word “set” as a property name?

Anyway, thanks in advance for any advice you may have. [import]uid: 21712 topic_id: 9454 reply_id: 34641[/import]

Cue shame. The issue was with the way I populated that field. Apparently a newline character was getting in. Since this is really of little help to anyone, feel free to delete this post on the next purging parade. hehe Thanks anyway, though. [import]uid: 21712 topic_id: 9454 reply_id: 34643[/import]