string - Why is `sData` a non-nil value? -


execution of code here on eval.in

smessage = "<hjpotter92> +help|" local _, _, scmd, sdata = smessage:find( "%b<>%s[%+%-%*%/%!%#%?](%w+)%s?(.*)|" ) print( _, sdata, scmd  ) 

the output of print says sdata value empty string.

why value not nil? created entire project based on sdata being nil such case, , find not so.


i've resolved trouble using block

if sdata:len() == 0      sdata = nil  end 

so, i'm not seeking solution make work. i'm asking, why not nil value?

why should nil?
getting successful match of pattern .* empty string.
nil means "no match found".
example


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -