FuturoAspira
New Member
Hello, I have questions about the efficiency of using local variables, who can help me... for example, what is the best way to use a local variable...
Case 1:
Case 2:
Case 3:
An example of this in TFS is creating a local variable in any file local var = print("ok"), and you can see that it is checked twice when the server starts. But if you put the variable inside the function, it is not checked when the server starts.

I would like to talk about this...
Case 1:
LUA:
local var1 = true
local var2 = true
function Test()
if var1 then
if var2 then
print("ok")
end
end
end
Case 2:
LUA:
function Test()
local var1 = true
local var2 = true
if var1 then
if var2 then
print("ok")
end
end
end
Case 3:
LUA:
function Test()
local var1 = true
if var1 then
local var2 = true
if var2 then
print("ok")
end
end
end
An example of this in TFS is creating a local variable in any file local var = print("ok"), and you can see that it is checked twice when the server starts. But if you put the variable inside the function, it is not checked when the server starts.

I would like to talk about this...