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: returned truthy of vim.fn #92

Merged
merged 1 commit into from
Jan 26, 2024
Merged

Conversation

kjuq
Copy link
Contributor

@kjuq kjuq commented Jan 26, 2024

In Lua, integer value is always recognized as true. So we should check if a returned value from vim.fn.has("win32") is 1 or not.

@davidmh
Copy link
Contributor

davidmh commented Jan 26, 2024

I just ran into the same issue, and the fix works for me.

From the Lua docs: https://www.lua.org/pil/2.2.html

Lua considers both zero and the empty string as true in conditional tests

@willothy
Copy link
Owner

willothy commented Jan 26, 2024

Yes, all values except nil and false are truthy in Lua. My bad, I forgot has returns an int. Should've caught that before merging.

I should really setup CI and tests. I will make sure to do that before I merge the 1.0 patch.

I will merge this fix shortly, sorry for the delay.

@willothy willothy merged commit 0338960 into willothy:main Jan 26, 2024
2 of 3 checks passed
@willothy
Copy link
Owner

Thanks for the PR! I appreciate it.

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.

3 participants