Forum

> > Off Topic > Method in BlitzMax
Forums overviewOff Topic overviewLog in to reply

English Method in BlitzMax

3 replies
To the start Previous 1 Next To the start

old Method in BlitzMax

Avo
User Off Offline

Quote
Hi, I'm getting started with BlitzMax and I met a problem which appears when below fragment of code is compiled (to be precise - the last line at screenshot; "Mis.Fired"):
IMG:https://s7.postimg.org/l5dn7qfm3/blitzproblem.png

Error: Unhandled Exception: Attempt to access field or method of Null object.

I'm not an expert, but I think that bm just tries to access field "Mis" in type TPlayer what obviously wasn't my point. I can simply get rid of this problem if I want to access variable that isn't declared in that type, I can use "global" key-word and everything works fine. But I'm not able to find solution for locals. I could use a function instead of a method, but I hope it's also possible with methods (it's quite shorter). Is anyone here who could help me?

Spoiler >

old Re: Method in BlitzMax

Starkkz
Moderator Off Offline

Quote
You must make sure that none of the objects in these indexes is null, otherwise you won't be able to access an object that does not exist.

Also, you can't access to the 100th object when you're using your array, it's actually the limit. You can access from 0 to 99.

old Re: Method in BlitzMax

Avo
User Off Offline

Quote
Thank you very much. It works without any compiler's error. I've forgotten that arrays in BM begins at 0, not at 1.

old Re: Method in BlitzMax

Apache uwu
User Off Offline

Quote
user Avo has written
Thank you very much. It works without any compiler's error. I've forgotten that arrays in BM begins at 0, not at 1.


Caveats with being a Lua scripter
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview