Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug with UDTs?
#1
Hi!

Tryed the following but got an error about invalid data types...

Code:
type hiscorestruct
   names as string
   punkte as integer
end type

dim hiscore(10) as hiscorestruct

temp$ = hiscore(tempnum).names

Is it a bug or did i do something wrong?

So Long, The Werelion!
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Reply
#2
Is there more to your code? What was posted compiled with 0.11 with no problem. It doesn't do anything...

... but it compiles and runs.

The following seems to work correctly:
Code:
type hiscorestruct
   names as string
   punkte as integer
end type

dim hiscore(10) as hiscorestruct

for counter = 0 to 10
  hiscore(counter).names = str$(counter)
next counter

tempnum = 5
temp$ = hiscore(tempnum).names

print temp$

sleep
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Reply
#3
i thought strings defined in a TYPE had to be fixed length i.e

Code:
DIM things as string * n


n being the length of the string of course
Reply
#4
FB allows dynamic strings on UDT's, but they won't be automatically deallocated when a local UDT (inside a sub-routine) goes off scope, thus leaking if you don't do myudt.mydynstr = "" at end of the sub.
Reply
#5
Quote:FB allows dynamic strings on UDT's, but they won't be automatically deallocated when a local UDT (inside a sub-routine) goes off scope, thus leaking if you don't do myudt.mydynstr = "" at end of the sub.

ARGHHH!!!!!
Thanks for that, i gona hit my head on the wall....
Quess what i forgot to put in the DIM foobar AS UDT... the inevitable shared.

I would fancy it if you would implement a metakeyword.
Code:
$GLOBAL ON
DIM a AS INTEGER
DIM b AS STRING
DIM c AS FLOAT
$GLOBAL OFF
All three above would be globals/shared

So Long, The Werelion!

Please close this >.<
color=red]Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?" - Shodan, AI at Citadel Station orbiting Earth[/color]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)