I searched this board, but I didn't find this particular bug, maybe I missed it.
It seems a type can only be declared in a subroutine if it is declared global.
This will not compile...
gosub init
print Richie.x
wait key
end
init:
type Rich
x as integer
endtype
Richie as Rich
Richie.x = 50
return
and this will not compile...
gosub init
print Richie.x
wait key
end
init:
type Rich
x as integer
endtype
local Richie as Rich
Richie.x = 50
return
but THIS will compile...
gosub init
print Richie.x
wait key
end
init:
type Rich
x as integer
endtype
global Richie as Rich
Richie.x = 50
return
It compiles fine with array types, I imagine because arrays are all global. Apologies if this has already been covered.
EDIT: forgot to say, it's DBP version 75