Bug? "Table field was not initialized

Anything related to Hollywood Designer goes in here
Post Reply
User avatar
Lerio69
Posts: 15
Joined: Sat Sep 24, 2016 11:47 pm
Location: Italy

Bug? "Table field was not initialized

Post by Lerio69 »

I' am a bit confused on how hollywood work with tables
You have write in a guide:

Code: Select all

You can access named elements of a table also in two ways: 
b = a["name"]
b = a.name
But for me this is not exactly.

I write this simple code:

Code: Select all

pStats={["A"]="Stat 1", ["B"]="Stat 2", ["C"]="Stat 3"}

a$ = pStats["A"]
b$ = pStats.B
The line 4 generate this error

Code: Select all

Error in line 4 (Unnamed1): Table field "b" was not initialized!
Why? What's wrong? What I have missing?

SamuraiCrow
Posts: 304
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Bug? "Table field was not initialized

Post by SamuraiCrow »

Internally, I think string keys are made lowercase if you use the dot notation. You're using the dot notation to try to look at a table element that is uppercase. Try either using the square brace notation in your lookup or make the keys lowercase in your assignment.
I'm on registered MorphOS using FlowStudio.

User avatar
Lerio69
Posts: 15
Joined: Sat Sep 24, 2016 11:47 pm
Location: Italy

Re: Bug? "Table field was not initialized

Post by Lerio69 »

Ok, thanks.

Post Reply