What's new

One more SublimeKSP syntax question (struct)

Fredeke

Senior Member
Hello again.

I'm doing something like this in SublimeKSP:
struct myStruct
declare ~myReal
end struct
declare &myStruct myArray [10]

Then, when I try to do this:
myArray[0].myReal := 0.00
...I get a precompiler error telling me myArray.myReal wasn't declared.

I thought I could get the logic behind that error. But then, when I try this:
~myArray[0].myReal := 0.00
...the precompiler gives the error "Expected Array Line" (which I don't even begin to understand) for that line.

Usually I would try every possible combination, but this time I'm asking whether someone knows how to spell this - and whether it is even possible to have reals inside a struct?
 
Btw,
Code:
?myArray[0].myReal := 0.00
doesn't work either. Same error as for the '~' version: myArray.myReal wasn't declared
 
I think this is a feature that has not been implemented yet. The compiled code does not contain a real array:

Code:
declare const $myArray__SIZE := 2
declare ~myArray__var[2] := (0.0)
 
I think this is a feature that has not been implemented yet. The compiled code does not contain a real array:

Code:
declare const $myArray__SIZE := 2
declare ~myArray__var[2] := (0.0)

Indeed!
Ìt should be
declare ?myArray__var[2] := (0.0)
with a ?, not a ~.

So it seems SKSP doesn't support reals in struct arrays (yet).

Ok, I'm done with structs. They're a good idea, but the implementation is too rigid for my needs. Now on to modifying my whole code accordingly... Well, I knew I took a risk trying a new feature (I mean new for me) - that's life.

I'm just going to manually do what I would have expected the precompiler to do for me. It's not that bad. Well, except for the rewriting of course. I should have tested this in a shorter script first :-/ (or maybe auto-replace can be my friend ? ;) )

Anyway -thanks for your insight.
 
Last edited:
Top Bottom