View Single Post
03-31-09, 06:14 AM   #22
Aezay
A Theradrim Guardian
 
Aezay's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 66
Now that we are already talking about "efficient" Lua code, I have a few things I've been wondering about lately.
String concats, I know they are bad to do many times as it will create a new sting each time, but I was curious which one of these lines would be the best to use? Does a concat of an empty string mean much?
Code:
label:SetText(FormatTime(timeLeft)..(showTotalTime and " / "..duration or ""));
label:SetText(showTotalTime and FormatTime(timeLeft).." / "..duration or FormatTime(timeLeft));
Is there any performance benefits in assigning multiple variables at the same times compared to one per line?
Code:
tbl.name, tbl.value, tbl.color = name, value, color;

tbl.name = name;
tbl.value = value;
tbl.color = color;
Also, what is this O-notation you're talking about?

watchout
Doh, you're right, ah well, not like it really means anything
  Reply With Quote