Page 1 of 1

Bug? "Table field was not initialized

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

Re: Bug? "Table field was not initialized

Posted: Mon Sep 09, 2019 12:27 am
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.

Re: Bug? "Table field was not initialized

Posted: Mon Sep 09, 2019 9:05 am
by Lerio69
Ok, thanks.