You don't even need to store a variable. If you only want to know if
any totem is active, you can return out of your function immediately as soon as you find one, without continuing to loop through the rest of the totem slots. You also don't need to explicitly return
false, as a nil value is the same.
Code:
local function HasActiveTotem()
for i = 1, 4 do
if GetTotemInfo(i) then
return true
end
end
end