07-22-2014, 08:21 PM
Okay, I think I figured out what my other problem is.
In 1.3 I could call a function in the code before it was declared providing I declared the function with a prototype at the top of the class. So this would've worked okay, despite the 'addWibble' function appearing after the call to 'addWibble':
In 1.4 this won't compile, it seemingly ignores the 'declare' prototype of the function and doesn't recognise 'addWibble' when it first encounters it, giving an error like this:
If you move the call below function like this then everything is fine:
HOWEVER.... it's a bit more complicated than that. It seems that I only see this effect if the function returns a String. If I quickly switch the function to return a ubyte instead then everything compiles fine.
Hope that makes sense!
In 1.3 I could call a function in the code before it was declared providing I declared the function with a prototype at the top of the class. So this would've worked okay, despite the 'addWibble' function appearing after the call to 'addWibble':
Code:
'function prototypes
declare function addWibble(msg as String) as String
'call addWibble even though it's declared down there vvvv
dim newMsg as String
newMsg = addWibble("Hello")
print newMsg
'return a string suffixed with 'wibble'
function addWibble(msg as String) as String
dim newString as String
newString = msg
newString = newString + "wibble"
return newString
end function
In 1.4 this won't compile, it seemingly ignores the 'declare' prototype of the function and doesn't recognise 'addWibble' when it first encounters it, giving an error like this:
Code:
TestFunction.bas:8: 'addWibble' is neither an array nor a function.
If you move the call below function like this then everything is fine:
Code:
'return a string suffixed with 'wibble'
function addWibble(msg as String) as String
dim newString as String
newString = msg
newString = newString + "wibble"
return newString
end function
'call addWibble even though it's declared down there vvvv
dim newMsg as String
newMsg = addWibble("Hello")
print newMsg
HOWEVER.... it's a bit more complicated than that. It seems that I only see this effect if the function returns a String. If I quickly switch the function to return a ubyte instead then everything compiles fine.
Code:
'function prototypes
declare function addWibble(msg as string) as ubyte
'call addWibble even though it's declared down there vvvv
dim newMsg as ubyte
newMsg = addWibble("test")
print newMsg
'return the number 1
function addWibble(msg as string) as ubyte
return 1
end function
Hope that makes sense!