• Multiple lines on a DLabel?
    13 replies, posted
Is this possible? If so how? I know you can probably do it by using /n but is there a cleaner way of doing it?
[lua]local text = [[I have text in a multiline string]] label:SetText(text)[/lua] Lua has a nice syntax for making multiline strings.
[QUOTE=Entoros;22118619][lua]local text = [[I have text in a multiline string]] label:SetText(text)[/lua] Lua has a nice syntax for making multiline strings.[/QUOTE] Works, kind of. It only shows the middle line though.
Because you you need to use [lua]\n[/lua] So, it would be: [lua]local text = [[I have text \n in a multiline \n string]] label:SetText(text)[/lua] [editline]11:10AM[/editline] "\n" means new line
[QUOTE=HeavyMtl123;22119999]Because you you need to use [lua]\n[/lua] So, it would be: [lua]local text = [[I have text \n in a multiline \n string]] label:SetText(text)[/lua] [editline]11:10AM[/editline] "\n" means new line[/QUOTE] No you don't, the Multiline strings handle that for you.
Bah I find that \n works fine for me.
You would have to use \n if you are not using multiline strings. [lua]local str = "This is line 1\nThis is line 2" local str = [[ This is line 1 This is line 2 ]][/lua]
Oh, well i've never had the need for multiline strngs, so i have never used them
[QUOTE=MakeR;22120406]You would have to use \n if you are not using multiline strings. [lua]local str = "This is line 1\nThis is line 2" local str = [[ This is line 1 This is line 2 ]][/lua][/QUOTE] Perfect, thankyou.
[QUOTE=HeavyMtl123;22120415]Oh, well i've never had the need for multiline strngs, so i have never used them[/QUOTE] If you dont know what your talknig about then why post?
[QUOTE=|King Flawless|;22123695]If you dont know what your talknig about then why post?[/QUOTE] Seriously, I will find you and rape your dead body.
[QUOTE=HeavyMtl123;22123723]Seriously, I will find you and rape your dead body.[/QUOTE] Please stay on topic
[QUOTE=|King Flawless|;22123757]Please stay on topic[/QUOTE] Agreed.
Or you could use [b][url=http://wiki.garrysmod.com/?title=DLabel.SetWrap]DLabel.SetWrap [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]?
Sorry, you need to Log In to post a reply to this thread.