The
lua demo page will help to a certain degree:
Code:
local iTest = 1
if type(iTest) == number then
print("iTest is a number")
end
results in an empy 'output screen'.
Code:
local iTest = 1
if type(iTest) == "number" then
print("iTest is a number")
end
results in an 'output screen' of
Your basic problem is that you are testing against a variable called
number which has never been initialized and therefore is 'nil'. 'v' in your code-construct will never be evaluated as
both 'nil'
and greater than '0'.
The
type(X) function in lua gives a string value, and therefore all evaluations against it must be stated as string values. (ie,
"number" instead of
number)
-----------------------------------------------------------------------------------------------
You could initialize variable
number, as in
but that wouldn't be any easier than just using
"number" as the value to evaluate against in your code.
--------------------------------------------------------------------------------------------------
Also, not sure why you are trying to iterate through each and every column in each and every row in the UnitPromotions table. There may be a more efficient way of doing whatever it is you really want to accomplish.