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 string.split returning an empty table if string starts with sepearator #7827

Merged
merged 1 commit into from Nov 1, 2018
Merged

Conversation

pyrollo
Copy link
Contributor

@pyrollo pyrollo commented Nov 1, 2018

Calling string.split(":A:B:C:D", ":") returns an empty array.

This is due to first empty string not making repeat loop decreasing max_split which has a 0 value when reaching until.

Changing max_splits default value from -1 to -2 fixes that issue (any lower value would fit).

…rator

Calling string.split(":A:B:C:D", ":") returns an empty array.
This is due to first empty string not making repeat loop decreasing max_split which has a 0 value when reaching until.
Changing max_splits default value from -1 to -2 fixes that issue.
@SmallJoker SmallJoker added Bugfix 🐛 PRs that fix a bug @ Builtin labels Nov 1, 2018
Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

Works as intended

@SmallJoker SmallJoker added One approval ✅ ◻️ Trivial The change is a trivial bug fix, documentation or maintenance change, as per the Git Guidelines labels Nov 1, 2018
@SmallJoker SmallJoker merged commit 0e306c0 into minetest:master Nov 1, 2018
osjc pushed a commit to osjc/minetest that referenced this pull request Jan 23, 2019
…rator (minetest#7827)

Calling string.split(":A:B:C:D", ":") returns an empty array.
This is due to first empty string not making repeat loop decreasing max_split which has a 0 value when reaching until.
Changing max_splits default value from -1 to -2 fixes that issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix 🐛 PRs that fix a bug @ Builtin One approval ✅ ◻️ Trivial The change is a trivial bug fix, documentation or maintenance change, as per the Git Guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants