-
Notifications
You must be signed in to change notification settings - Fork 363
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
Add shorthand macros for some conventient Lua string operations #2181
Conversation
Of course there's the question of whether it actually makes sense to do this in C at all, when wrapping them individually in macros file would be easier in many ways. The other question is the naming: |
Yet another question is whether it'd be saner to just do to do a native Lua call doString() directly. It'd be a few lines more probably but then we could give saner error messages, eg
The rest of the message is entirely reasonable but the "lua script failed" part is somewhat disorienting... |
What, no bikeshedding on the names? 😆 |
@pmatilai, the CI should now be fixed, please force push to this branch to trigger a new job. |
Despite all the Lua magic we already do, it's annoyingly often the case that shelling out is easier (or at least shorter) than doing the same in Lua (substrings, length etc) Add shorthand macros %gsub, %len, %lower, %rep, %reverse, %sub and %upper which simply wrap the corresponding Lua string.* functions for convenience.
The newly setup Semaphore project only catches new PR's so this is going to remain in limbo. |
The names are perfect BTW |
I should take a screenshot of that comment and put it on the wall 😁 |
Despite all the Lua magic we already do, it's annoyingly often the case that shelling out is easier (or at least shorter) than doing the same in Lua (substrings, length etc)
Add shorthand macros %gsub, %len, %lower, %rep, %reverse, %sub and %upper which simply wrap the corresponding Lua string.* functions for convenience.