You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function _M.find_in_string(source_string, matching_string)
return ngx.re.find(source_string, matching_string, "jo")
end
and I try to replace the ngx.re.find with localize var like this
local ngx_re = ngx.re
local ngx_re_find = ngx_re.find
function _M.find_in_string(source_string, matching_string)
return ngx_re_find(source_string, matching_string, "jo")
end
the first version find_in_string(nil, "") will return nil
the second version find_in_string(nil, "") will raise an exception: bad argument #1 to 'find_in_string' (string expected, got nil)
why is that?
The text was updated successfully, but these errors were encountered:
the second version call the old lua-c version ngx.re.find, and the first version call the ffi base (after requre "resty.core") version will cause this. by the way the newest version of openresty load the ffi function at lua vm init.
the second version call the old lua-c version ngx.re.find, and the first version call the ffi base (after requre "resty.core") version will cause this. by the way the newest version of openresty load the ffi function at lua vm init.
openresty-1.13.6.2
I wrote function like this
and I try to replace the ngx.re.find with localize var like this
the first version
find_in_string(nil, "")
will return nilthe second version
find_in_string(nil, "")
will raise an exception: bad argument #1 to 'find_in_string' (string expected, got nil)why is that?
The text was updated successfully, but these errors were encountered: