ZScript: Left hand side of Size must point to a class object

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: ZScript: Left hand side of Size must point to a class object

Re: ZScript: Left hand side of Size must point to a class ob

by phantombeta » Sun Nov 17, 2019 6:27 am

Duplicate of this report. (Yes, this one was posted first, but the other one got closed first.)

Re: ZScript: Left hand side of Size must point to a class ob

by Graf Zahl » Wed Oct 31, 2018 11:29 am

The real issue here is the error message. The VM cannot take arrays as pointers so they cannot be passed as parameters directly unless wrapped into a class.

Re: ZScript: Left hand side of Size must point to a class ob

by gramps » Tue Oct 30, 2018 8:36 pm

Huh, that's weird...

Just searching the git repo, it looks like the error comes from here, and as far as I can tell tracking it back from there, it can't convert that array pointer to a container, because it doesn't have a "TYPE_Container" flag. An array sounds like a container to me, and i guess pointers are supposed to be automatically dereferenced, so it looks like an oversight (or just not implemented yet).

Can also confirm what m8f said; try adding Array<Object> qux; qux = arr;

Re: ZScript: Left hand side of Size must point to a class ob

by stan423321 » Tue Oct 30, 2018 12:06 pm

Hmm. Is that a hint to engine developers, or something I'm supposed to unwrap myself?

Re: ZScript: Left hand side of Size must point to a class ob

by m8f » Mon Oct 22, 2018 9:09 am

It seems that when the dynamic array is passed as a parameter, it is considered a value of type Pointer<DynArray<something>> instead of just DynArray<something>.

ZScript: Left hand side of Size must point to a class object

by stan423321 » Sun Oct 21, 2018 10:33 am

I'm not even sure how to comment on this. Here's a minimal example. Following ZScript

Code: Select all

version "3.4"

class Foo {
	uint Bar(Array<Object> arr) {
		return arr.Size();
	}
}
errors out with

Code: Select all

Script error, "arraybug.pk3:zscript.txt" line 5:
Left hand side of Size must point to a class object
Wrapping the array in an object worked for now in the actual project, but adds to boilerplate. I assume that this is a bug since... why would one allow dynarray parameters otherwise? Found on 3.6.0, retested on 3.7.pre-9-g4ac43dac, both 64-bit. Do we need specs for this?
Attachments
arraybug.pk3
Nothing but ZScript in the post is in this mod.
(245 Bytes) Downloaded 71 times

Top