Skip to content

Conversation

@Benjamin-Dobell
Copy link
Member

@Benjamin-Dobell Benjamin-Dobell commented Jul 28, 2020

At the moment non-string access on Color e.g.

Color[nil]

will raise an error.

Whilst the above example could reasonably be considered user error, index keys (i.e. numbers) are funnelled through when indexing a Color instance. So if you attempt to index a Color instance outside the range [1, 4], rather than getting nil back as you'd expect for non-existent keys on a table, instead an error is presently being raised.

Reproduction

e.g. Entering the following in TTS' chat:

/execute log(Color()[5])

Leads to:

attempt to index a number value

where as you'd expect to see nil logged.

@Benjamin-Dobell
Copy link
Member Author

Force pushed in some tests.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant