Mr_Moose Posted October 7, 2014 Share Posted October 7, 2014 (edited) I got a GUI memo which loads it's text from a data source similar to this: local text = [[Long text document here... value property value2]] Now, the problem is to make the indentation to the word 'value' equal on both the lines (using a non courier font), usually '\t' would have solved this, but in this case it only outputs '\t' as in it's source. Inserting and justifying with space doesn't work either since the vertical lines never get's straight. Any ideas or alternatives to '\t' in lua? Edited October 8, 2014 by Guest Link to comment
MTA Team botder Posted October 7, 2014 MTA Team Share Posted October 7, 2014 text = text:gsub("\\t", "\t") Link to comment
Mr_Moose Posted October 7, 2014 Author Share Posted October 7, 2014 Nope, that will only remove the '\t', I'm looking for the same effect you get in other programming languages like C, where '\t' is converted to an indentation. Link to comment
MTA Team botder Posted October 7, 2014 MTA Team Share Posted October 7, 2014 text = text:gsub("\\t", " ") Maybe whitespace? Link to comment
Mr_Moose Posted October 7, 2014 Author Share Posted October 7, 2014 Whitespace would have the same effect as regular space, it may look nice in the code editor where the font is courier or monospace, (all letters has equal width), the problem is that even if the layout looks nice in the code it won't be a straight vertical line in game (with a different more nice looking font), of course there are other solutions like changing the layout of the text or use courier or moonscape fonts for example but I can't really see why it should be any difference in lua compared to kind of all other languages where you can make nice looking table structures using '\t'. outputChatBox("test1\ttest2") This appears to produce the same result, '\t' is just ignored, there might be a reason for it in some cases but somehow it must be possible to solve. 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