http://snippets.bentasker.i2p/posts/lua/check-if-variable-is-numeric.html
Sometimes, though, we need to check that a value is of a given type - a LUA component of a WAF might, for example, want to check that a specific query-string argument is numeric This snippet focuses solely on that use-case - checking that a variable/string is numeric in format Similar To Python str.isnumeric() PHP is_numeric() Details Language: LUA License: BSD-3-Clause Snippet function is_numeric ( x ) if tonumber ( x ) ~= nil then return true end return false end Usage Example vals = { "1234" , "abcd" ,...