ScaWscR Posted June 25, 2016 Share Posted June 25, 2016 Hello guys, A string : DATA = "DataPlayer" the data len is #DATA = 9 i want change it to: if #DATA > 7 then "DTaPlay.." how can i do it ? end 2 e.g Datax = "MTAsangoodplayers" to ; if #Datax > 7 then to; "MTAsango.." end I hope you understand me It was a bit confused Link to comment
Bonsai Posted June 25, 2016 Share Posted June 25, 2016 I once made something like that for a Rankingboard, maybe its what you need. It works fine for me, but you should probably not use it inside a render function. function RankingBoard.dxClipTextToWidth(text, width) while dxGetTextWidth(text, RankingBoard.fontSize, RankingBoard.font, true) > width do text = text:sub(1, #text-1) end return text end Link to comment
ScaWscR Posted June 25, 2016 Author Share Posted June 25, 2016 function Dltsx(data,x) if type(data)=="string" then while #data > x do data = data:sub(1, #data-1) end return data..".." else return false end end outputChatBox(Dltsx("MTAsangoodplayers",7)) Thank you very much ! Link to comment
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