what is the syntax to test if a field is empty?
COMMUNITY QUESTION
empty test syntax?
1 answer
If you mean empty as in null, then you're looking for nil.
local variable = nil
if variable == nil then --// Can also be written as 'if not variable then', but that would make the if statement run if 'variable' was false (which is not nil).
print("Variable doesn't exist!")
end
If you mean an empty string, then..
local variable = ''
if variable == '' then
print('Empty string!')
end
Hope this helped.
This discussion is preserved as it was. New answers, comments, and votes are closed.
