Skip to content

Remove errors from functions that return LuaType#211

Merged
natecraddock merged 1 commit intomainfrom
luatype
May 6, 2026
Merged

Remove errors from functions that return LuaType#211
natecraddock merged 1 commit intomainfrom
luatype

Conversation

@natecraddock
Copy link
Copy Markdown
Owner

These functions mapped LuaType.nil to a Zig error. When the returned type is used, nil is still one of the possible values, even though in the case of an error that is not possible. That leads to needing to handle the "nil" case twice (once in the error union, once in the return value).

I think it makes more sense to not return errors for these functions.

These functions mapped LuaType.nil to a Zig error. When the returned
type is inspected, nil is still one of the possible values, even though
in the case of an error that is not possible.

I think it makes more sense to not return errors for these functions.
@natecraddock
Copy link
Copy Markdown
Owner Author

@robbielyman curious on what you think of this

I also wonder if it would be good to make a new enum LuaTypeNone that contains the .none field and use that for the functions that can return .none, and then remove .none from LuaType...

@robbielyman
Copy link
Copy Markdown
Collaborator

I'm in favor of this change, and the proposed LuaTypeNone change as well!

@natecraddock
Copy link
Copy Markdown
Owner Author

Great thanks for taking a look! I guess now I need to determine which functions can return none 🙃

@natecraddock natecraddock merged commit c4225d8 into main May 6, 2026
3 checks passed
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