Page 1 sur 1

[RESOLU] Error : Tableaux en argument

Publié : jeu. 11/déc./2008 19:34
par Progi1984
Salut, travaillant sur Moebius et préparant un exemple utilisant les tableaux en argument de procédure.

Mais j'ai un message d'erreur
COMPILER Ligne 4: The number of dimensions needs to be at least 1; for MyArrayL()

Code : Tout sélectionner

ProcedureDLL S08_GetVarL(MyArrayL.l(10), Num.l) ; Commebt
	Protected sContent.s, lInc.l
	For lInc = 1 To  10
	  sContent + "ID : " + Str(lInc)+ " - Element : "+Str(MyArrayL(lInc))
	Next
	MessageRequester("S07_GetVarL", sContent)
	ProcedureReturn #True
EndProcedure
ProcedureDLL S08_GetVarS(Num.l, MyArrayS.s(10))
	Protected sContent.s
	For lInc = 0 To  9
	  sContent + "ID : " + Str(lInc)+ " - Element : "+MyArrayS(lInc)+Chr(13) + Chr(10)
	Next
	MessageRequester("S07_GetVarS", sContent)
	ProcedureReturn #True
EndProcedure
ProcedureDLL S08_GetVarPoint(MyArrayPoint.Point(10))
	Protected sContent.s
	For lInc = 0 To  9
	  sContent + "ID : " + Str(lInc)+ " - Element X: "+Str(MyArrayPoint(lInc)\x)+ " - Element Y: "+Str(MyArrayPoint(lInc)\y)+Chr(13)+Chr(10)
	Next
	MessageRequester("S07_GetVarPoint", sContent)
	ProcedureReturn #True
EndProcedure
Exemple :

Code : Tout sélectionner

Dim AnyArrayL.l(11)

For Inc = 0 To 10

  AnyArrayL(Inc) = Random(255)

Next



Dim AnyArrayS.s(11)

For Inc = 0 To 10

  AnyArrayS(Inc) = "S"+Str(Random(255))+"S"

Next



Dim AnyArrayPoint.Point(Inc)

For Inc = 0 To 10

  AnyArrayPoint(Inc)\x = Random(255)

  AnyArrayPoint(Inc)\y = Random(255)

Next



S08_GetVarL(AnyArrayL(), 5)

S08_GetVarS(5, AnyArrayS())

S08_GetVarPoint(AnyArrayPoint())

Publié : jeu. 11/déc./2008 19:43
par comtois
Ce n'est pas le nombre d'éléments qu'il faut indiquer mais le nombre de dimensions du tableau.

Remplace tes 10 par des 1 et ça devrait fonctionner.

Publié : jeu. 11/déc./2008 19:44
par Progi1984
Ah ouaip, ca marche bcp mieux. Merci comtois :)