Open noroads2015 opened 3 years ago
You should wrap your code into three backticks ... to avoid github issues eating [0]()
as link :)
SuperStrict
Framework Brl.StandardIO
Local f:String(n:Int)[10]
f[0] = Func0
f[1] = Func1
f[2] = Func2
Print f[0](111)
Print f[1](222)
Print f[2](333)
Function Func0:String(n:Int)
Return "You passed "+n+" into Func0"
End Function
Function Func1:String(n:Int)
Return "You passed "+n+" into Func1"
End Function
Function Func2:String(n:Int)
Return "You passed "+n+" into Func2"
End Function
Thanks GWRon. Wonder why it doesn't already do that when I click the "insert code" icon?
Assume it is the "single tick" version - any maybe it has trouble with multi line code then :)
I assume this is a "bcc/bmk" bug, not a "bmx-ng" bug - so issue might have to be moved (by @woollybah). Just in case you wonder the ticket/issue moves to another repo :)
It works when not utilizing the array index access:
Local fNonArray:String(n:Int)
fNonArray = Func0
Print fNonArray(111)
Looks related to bmx-ng/bcc/issues/444.
Describe the bug Trying to create an array of function pointers. Works fine in vanilla BlitzMax, but gives errors in NG Expression of Type String cannot be inkoked. To Reproduce
Expected behavior Works as expected in Vanilla Blitzmax. Fails with error in NG
Version information (please complete the following information):
Edit: seems the GitHub web parser doesn't like my source code. The Print statements should read You can see my post here https://www.syntaxbomb.com/index.php/topic,8280.msg347047941.html#msg347047941