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 » Sun Sep 08, 2019 1:24 pm

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: 241
Joined: Fri May 15, 2015 5:15 pm
Location: Ft. Collins, Colorado USA

Re: Bug? "Table field was not initialized

Post by SamuraiCrow » Mon Sep 09, 2019 12:27 am

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.

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 » Mon Sep 09, 2019 9:05 am

Ok, thanks.

Post Reply