Skip to content
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

Fix error if Color is indexed with a non-string #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant