ilnaz Posted May 17, 2020 Posted May 17, 2020 local text = [[text]] how insert in this "text" other words?
Moderators IIYAMA Posted May 17, 2020 Moderators Posted May 17, 2020 (edited) 13 minutes ago, ilnaz said: local text = [[text]] how insert in this "text" other words? Insert as in adding more words? local text = [[text]] text = text .. " is something ..." Your are using a multiline format, but it doesn't change the fact that it is still a string. The only difference about it, is that it automatic adds newlines. (and maybe some other stuff that I do not know about) local text1 = "text\ntext" print(text1) local text2 = [[text text]] print(text2) Edited May 17, 2020 by IIYAMA Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ilnaz Posted May 17, 2020 Author Posted May 17, 2020 i use [[ ]] for replace symbol "\" in text 'example\example'
Moderators IIYAMA Posted May 17, 2020 Moderators Posted May 17, 2020 2 hours ago, ilnaz said: i use [[ ]] for replace symbol "\" in text 'example\example' That doesn't sounds right. Multi-line strings do generate "\n", for each new line, not just "\". What do you want to achieve? Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Moderators IIYAMA Posted May 18, 2020 Moderators Posted May 18, 2020 2 minutes ago, ilnaz said: i remove "\" and save next symbol local theString = "blabla1\blabla2" local words = split ( theString, 92) -- returns a table with all items split by \, which is ASCII code 92 iprint(unpack(words)) https://wiki.multitheftauto.com/wiki/Split https://wiki.multitheftauto.com/wiki/ASCII Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now