GLBasic forum

Feature request => IDE/Syntax => Topic started by: spacefractal on 2011-May-31

Title: automatic convert int to object from function
Post by: spacefractal on 2011-May-31
Code (glbasic) Select

//LOCAL col AS Col_Data
LOCAL col=Map_Collision(32, 99)

TYPE Col_Data
x
y
l
tile
origtile
ENDTYPE

FUNCTION Map_Collision AS Col_Data: xpos, ypos //, sourceimage=-1, origtile=0
LOCAL col AS Col_Data
RETURN col
ENDFUNCTION


If I doing above I got a lots of annoyring FATAL ERROR rather to automatic either sport the error while comping or convert the object automatic when I used a local. This mean I cant use a function, that return a object to a IF directly, but need more lines due this.....

PS. If I remove the slashes its works. But since its not really a bug, but more a request, I post it in the request thread instead.

Title: Re: automatic convert int to object from function
Post by: Kitty Hello on 2011-May-31
LOCAL col= <-- col is a floating point number!!
LOCAL col AS Col_Data // correct
LOCAL col AS Col_Data = Map_Collision(332,32) // Does that work? I think not.
Title: Re: automatic convert int to object from function
Post by: spacefractal on 2011-May-31
1. Gl compiler should detect that error before compiler c++ part. Those fatal errors is pretty hard to read and detect where the issue is. Since its not notice which Line its was. So a better error message would been nice.

3. I remember its did not work, but test when whent home. But its would been fine if possible...

But again no bugs, its more better error handling. That why its not in big forum.