XkPP Posted July 14, 2022 Share Posted July 14, 2022 --as an example: gg.alert(string.format("abcdefg"):sub(7)) this section(:sub) goes to the right, how to do it to the left? Please help Link to comment Share on other sites More sharing options...
CmP Posted July 14, 2022 Share Posted July 14, 2022 Direct answer to the question is present in Lua reference manual: Quote string.sub (s, i [, j]) Returns the substring of s that starts at i and continues until j; i and j can be negative. If j is absent, then it is assumed to be equal to -1 (which is the same as the string length). In particular, the call string.sub(s,1,j) returns a prefix of s with length j, and string.sub(s, -i) (for a positive i) returns a suffix of s with length i. https://www.lua.org/manual/5.3/manual.html#pdf-string.sub Link to comment Share on other sites More sharing options...
XkPP Posted July 15, 2022 Author Share Posted July 15, 2022 @CmP 14 hours ago, CmP said: Direct answer to the question is present in Lua reference manual Thank you for helping, now it's working Link to comment Share on other sites More sharing options...
Question
XkPP
this section(:sub) goes to the right, how to do it to the left?
Please help
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.