DTextEntry crashing client with to much whitespace.

So, making a quick admin interface to view and monitor active E2 chips.

We’ve had a large spat of people spamming laggy E2 devices around and I always want to allow some of the more abusable E2 functions that we’ve blacklisted so a quicker way to monitor idiots was needed.
Before anyone screams “Noooo ma e2 codes!”, only root admins have access to the snooper features, and if you’ve server access you can view spawned e2’s via lua anyway so having a nice gui means nothing :slight_smile:

http://share.bybservers.co.uk/2014-01-16_14-31-55.png[/T]
Clicking E2 shows:
[T]http://share.bybservers.co.uk/Garry’s_Mod_2014-01-16_15-05-58.png

Anyway it all works fine unless there is to much whitespace per line, things like:



@name e2snoopecrasher22
@persist Allow:array
interval(1)
Allow = array(1,2,3)
for (I=1,Allow:count()){
                                                                            Already = 1
                                                                            break
}


Crash the client, any ideas why?

The clientside lua for the text entry:



local n=0
	for i in code:gmatch("
") do n=n+1 end
	n = n * 15
	if n > 1000 then n = n - 900 end
	TextBox:SetSize(TextBoxHolder:GetWide()-20,1000+n);
	TextBox:SetEditable(false);
	TextBox:SetPos(2,2);
	TextBox:SetValue(code);
	TextBox:SetMultiline(true);
	TextBoxHolder:AddItem(TextBox);


The n = n * 15 was a lazy (and probably not the best) way to get the text box to set it’s height based on lines, although I think a lines only 14.x tall.



@name Pie
                                                                        #cake


Does not crash it.



@name Pie
                                                                       Apple = 1


That however does, so odd. Why should the #cake comment take mater when it’s just a string :s

Not actually sure why that would crash, but have you tried using RichText?

I have not / I shall try when able (morning most likely).

This appears to have fixed the crashing, although it seems that using SetText() has a character limit, but I can split the string and use append text.

http://share.bybservers.co.uk/Garry’s_Mod_2014-01-17_02-18-45.png

Thanks, all working now :). Although no idea why my original idea above would crash :/.

-edit

No post merge? Wasn’t that long between posts :s

If anyone knows a nice way to add a horizontal scrollbar then lemme know.