New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type of vector loop index is int, not count #213

vpax opened this Issue Nov 15, 2018 · 1 comment


None yet
2 participants
Copy link

vpax commented Nov 15, 2018

The following code snippet prints "int", not "count": for ( i in vector("a") ) print type_name(i);, even though the documentation sez

A vector is like a table, except it’s always indexed by a count

The problem is the use of basetype(TYPE_INT) in ForStmt::ForStmt.

@jsiwek jsiwek added this to the 2.7 milestone Jan 11, 2019

jsiwek added a commit that referenced this issue Jan 15, 2019


This comment has been minimized.

Copy link

jsiwek commented Jan 15, 2019

I've changed vector loop index to count since it more closely matches expectation/meaning. Hypothetically, that could alter script behavior, but I can't think of any practical case where it would -- likely only when someone is inspecting the type of the variable, but I don't see any reason to write code that depends on that. Let me know if there's contrary opinion.

@jsiwek jsiwek closed this Jan 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment