Reading strings with spaces in datafiles

Moderator: POL Developer

Locked
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

Reading strings with spaces in datafiles

Post by garyglitter »

Noticed this bug recently. Any prop with a string as a result seems to have trouble being read, not saved.

It's saved within a structure, so it might be the structures that are bugged. This is what i basically have to save to a datafile.

var structure

structure.+thing := "a space!"

element.setprop("test", structure)

Now opening up the actual data file reveals that this saves perfectly.

However this...

Print(element.getprop("test").thing)

will return <"uninitialized object"> on EVERY string that has a space. I've tried saving the string in an array like.

structure.+thing := {"a space!"}

and Print(element.getprop("test").thing) still returns <"uninitialized object"> for any string with a space. Every other string is returned as {string}, works fine.

I then tried what the result of

res := SplitWords("a space!")

structure.+thing := res

And that returns <"uninitialized object"> too. So with an array with 2 words, no spaces it returns this error

hmm

So it's either a bug with accessing data files, or a bug with structures, OR a bug with structures IN datafiles :P Either way, I wasted enough time on it so someone else can test if they want. From the responses in my other bug report, it's kinda pointless reporting bugs anyway :P
xeon
Forum Regular
Posts: 338
Joined: Fri Oct 31, 2008 3:18 am
Location: Italy

Re: Reading strings with spaces in datafiles

Post by xeon »

I think that prop names don't "allow" spaces inside.
garyglitter
New User
Posts: 13
Joined: Wed May 16, 2012 5:19 pm

Re: Reading strings with spaces in datafiles

Post by garyglitter »

xeon wrote:I think that prop names don't "allow" spaces inside.
They allow spaces fine.

I just made a test command and it's working perfectly there. I'm stumped on this now. Something I failed to mention is that the data file was created in POL093 and used in 098. All other methods of accessing worked though.

Guess I'll put it down to me :P
Locked