function return $string ?

Blitz3D Forums/Blitz3D Beginners Area/function return $string ?

GC-Martijn(Posted 2005) [#1]
Small question,

Is it posible to return a string ?

This small code for example
Graphics 320,240,32,2
SetBuffer BackBuffer()
ClsColor 212,208,200
Cls
While Not KeyHit(1)

	bla$ = Text(Input$(""))
	Print bla$ ; wil give a 0
Flip
Wend
End

Function Text(la$)
Return "this is a string"
End Function



DJWoodgate(Posted 2005) [#2]
Function Text$(la$)


GC-Martijn(Posted 2005) [#3]
a Thanks DJwoodgate :)


Dazman(Posted 2005) [#4]
Your example code will not work even if you correct the spelling error. It is certainly possible to return a string from a function though:

Print gettext$()

Function gettext$()
Return "this is returned text"
End Function


GC-Martijn(Posted 2005) [#5]
@Dazman

This was a short example of the problem not a real script.

I use something like this
bla$ gettext$(Input$("")) 
text x,y,bla$

Function gettext$(bla$) 
;some code...
Return bla$
End Function 



Dazman(Posted 2005) [#6]
How about this:

bla$=Input$("")

Print gettext$(bla$)
WaitKey

Function gettext$(bla$)
bla$=bla$+" has been modified"
Return bla$
End Function

or this:

result$=gettext$(Input$(""))
Print result$
WaitKey

Function gettext$(bla$)
bla$=bla$+" modified"
Return bla$
End Function

P.S. so long since i posted here i've forgotten how to do codeboxes, sorry


_PJ_(Posted 2005) [#7]
Dazman -
{codebox}

{/codebox}

though of course, SQUARE brackets!


Dazman(Posted 2005) [#8]


:-)


_PJ_(Posted 2005) [#9]
no problem ;-)