Hello,
More String Array queries from me.
Is it possible, or what is the correct way to define a multidimensional string array in AGK2 and pass this as a reference to a function in AGK2?
For single dimension I can use
Global array as string[100]
someFunction( array )
function someFunction (data ref as string[])
data[0] = "Test"
data[1] = "Program"
endfunction
However for multidimension string arrays, this always results in an error.
For example
global dim g_strNotesChannel[2,100] as string
global dim g_strDurationChannel[2,100] as float
loadTuneToArrayChannel("config/CodeDataChannel2.txt", g_strNotesChannel, g_strDurationChannel,0)
loadTuneToArrayChannel("config/CodeDataChannel2.txt", g_strNotesChannel, g_strDurationChannel,1)
//
// Load a configuration file to an Array of Notes and Duration
// This gives flexibility
//
function loadTuneToArrayChannel(filename as string, noteArray ref as string[][], durationArray ref as float[][], channel as integer)
file = OpenToRead(filename)
// Error checking removed for code clarity
index = 0
while (FileEOF(file)=0)
line$ = ReadLine(file)
note$ =GetStringToken(line$,",",1)
duration# =ValFloat( GetStringToken(line$,",",2) )
noteArray[channel, index] = note$
durationArray[channel, index] = duration#
inc index
endwhile
CloseFile(file)
endfunction
Kind Regards
Jason
https://www.facebook.com/WonkyPix
http://www.wonkypix.com
http://www.appstore.com/jsecconsultancyltd