'Expression of type 'Int Array' cannot be invoked'

BlitzMax Forums/BlitzMax Beginners Area/'Expression of type 'Int Array' cannot be invoked'

Ant(Posted 2005) [#1]
Newbie alert! Hi, I'm trying to convert some code that displays a proportionally spaced font and restructure it to more OOP orientated code as I want to load multiple fonts (and generally as an exercise).

I have declared a type and have a couple of methods, one of them being DrawBmpFont. This is the code which is part of the type:

Method DrawBmpFont(text$,x,y)
Local i=0
For i=0 Until text.length
DrawImage imgFont,x,y,Asc(text[i..i+1])-32
x:+iWidthTable(Asc(text[i..i+1])-32)
Next
EndMethod

Now when it hits the x:+iWidthTable...... line it displays the error

'Expression of type 'Int Array' cannot be invoked'

- What does this mean??? Thanks for any help guys.


skidracer(Posted 2005) [#2]
You need to use square brackets to index the elements in the iWidthTable:

x:+iWidthTable[Asc(text[i..i+1])-32]


Ant(Posted 2005) [#3]
Oh dear god. Schoolboy error. Thanks!