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

Throw error if holo index is NaN #3135

Merged
merged 8 commits into from
Sep 9, 2024
Merged

Throw error if holo index is NaN #3135

merged 8 commits into from
Sep 9, 2024

Conversation

Zvbhrf
Copy link
Contributor

@Zvbhrf Zvbhrf commented Sep 7, 2024

I think the title explains the change.
If you use, for instance, holoCreate(0/0), Expression2 will throw a Lua error. It might be difficult for e2 users to figure out whats wrong with their code, so just throw an Expression2 error.

Ignore the other commits, I changed my mind how to fix the problem, while I was fixing it.

local function CheckIndex(self, index, shouldbenil)
index = math.Clamp(math.floor(index), -2^31, 2^31)
if index ~= index then return self:throw("holo index is NaN!", 0) end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default in this throw should be nil instead of 0 I think

Zvbhrf and others added 2 commits September 10, 2024 01:42
The new local is unnecessary

Co-authored-by: thegrb93 <grbrown93@sbcglobal.net>
Remove local

Co-authored-by: thegrb93 <grbrown93@sbcglobal.net>
@thegrb93 thegrb93 merged commit a47523b into wiremod:master Sep 9, 2024
1 check failed
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.

2 participants