View Single Post
08-18-14, 01:07 PM   #9
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,335
Originally Posted by Malakahh View Post
Code:
--Removing this if statement causes something called a Tail Call (this is new to me as well), which will result in "zero" and "one" getting output, but not file2. 
if 1 == 1 then
	return
end
I didn't notice the comment before, but it's incorrect. Following my explanation earlier, removing the conditional surrounding the return statement will cause Lua to throw a syntax error since the return is no longer appearing at the end of a chunk.



Also using a conditional that always evaluates as true can be replaced with the following code for faster execution.
Code:
do
	return
end
Forcing return into a do ... end bypasses the syntax error since it is at the end of the chunk.


Note whitespace is irrelevant to Lua, so the previous code could be written as this to make it better to read.
Code:
do return end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote