Author Topic: automatic convert int to object from function  (Read 1982 times)

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3928
    • View Profile
    • Space Fractal
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.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10752
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: automatic convert int to object from function
« Reply #1 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.

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3928
    • View Profile
    • Space Fractal
Re: automatic convert int to object from function
« Reply #2 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.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.