Can I do this, and if so how?

BlitzMax Forums/BlitzMax Beginners Area/Can I do this, and if so how?

MGE(Posted 2007) [#1]
Pardon my ignorance, but can this be done? Thank you for your time.
'
A()
'
Function A()
B(C)
End Function
'
Function B(ptr)
ptr()
End Function
'
Function C()
End Function


BlackSp1der(Posted 2007) [#2]
function pointers?

A() 

'
Function A()
	B(C)
End Function
'
Function B(call())
	call()
End Function
'
Function C()
Print "ok"
End Function 



MGE(Posted 2007) [#3]
That seemed to do the trick! Thanks!! :) :) Now here's one for ya... ;)

Q) What's the best way to get a random object from a TList?


SculptureOfSoul(Posted 2007) [#4]
ListObject.ValueAtIndex( rand( ListObject.Count() - 1 ) )


MGE(Posted 2007) [#5]
Oh dear god...that was too obvious, thanks!. And also thanks SOS for proving how much of a BlitzMax noob I am. :) :)


SculptureOfSoul(Posted 2007) [#6]
From one noob to another, don't worry. :D


MGE(Posted 2007) [#7]
Well, here we grow again... :)

When the Graphics() function fails, what's the best method to visually tell the user there was a problem? Since there's no screen available, how do we display information to them? Thanks.


Grey Alien(Posted 2007) [#8]
Notify :-)

Hey you should buy my framework, then you won't have to write one, you'd have saved tons of time already ;-) kidding I know you want to write one for fun (or something)


Gabriel(Posted 2007) [#9]
I tend to use notify.

Notify("There was a problem initializing video mode. Please update your videocard drivers and try again.")



coffeedotbean(Posted 2007) [#10]
notify "buy a gfx card"



Grey Alien(Posted 2007) [#11]
too sloooooow....


coffeedotbean(Posted 2007) [#12]
doh!


MGE(Posted 2007) [#13]
Thanks!! eek!! Ok, jeesh...another easy solution. Phew!! :) :) :)
GA - Your idea and my idea of framework is totally different. lol.. Your's is a complete robust (impressive) "solution", MGE will not be a framework, more like a took kit you can plug in any app. They should (knock on wood) work wonderfully together. ;) At this point if I was to buy a framework it would save me perhaps months of coding, but I wouldn't come out any smarter. doh! ;)


Grey Alien(Posted 2007) [#14]
for sure writing a framework is a great learning exercise and at the end you have something useful :-)