gfind_aux
function · lua · boundary
- Address
0x7fcff0· 232 bytes, up to0x7fd0d7- Meaning
- Returns the next match of a gfind iterator and advances its position upvalue
- Confidence
- verified, proof one
- Finding
- lua/libs#search-and-replace
Finding: Search and replace in lua: the libraries
str_find searches for a pattern, or for a plain string when the fourth argument is true or the
pattern has none of the characters ^$*+?.([%-, and answers the start, the end and the captures.
gfind returns an iterator closure over gfind_aux, which carries the subject, pattern and
next position in three upvalues. str_gsub replaces matches with a string or a function result
through add_s and answers the new string and the count. push_captures and push_onecapture
push the captures, lmemfind is the plain search.
| function | name | decided by |
|---|---|---|
0x7fc3b0 | str_find | luaL_optnumber init (0x7fc3f2), lua_toboolean plain (0x7fc41c), strpbrk of the special set (0x7fc432), lmemfind (0x7fc515) |
0x7fce50 | lmemfind | memchr of the first byte (0x7fce99), an empty needle returns the start |
0x7fcee0 | push_captures | luaL_checkstack too many captures (0x7fcef4), whole match by lua_pushlstring (0x7fcf0f), push_onecapture (0x7fcf29) |
0x7fcf40 | push_onecapture | length -1 raises unfinished capture (0x7fcf57), -2 pushes a position (0x7fcf79, 0x7fcf94) |
0x7fcfa0 | gfind | two luaL_checklstring, lua_settop 2 (0x7fcfc4), 0 pushed, lua_pushcclosure with 3 upvalues (0x7fcfdd) |
0x7fcff0 | gfind_aux | upvalues read by lua_tostring and lua_tonumber (0x7fd003..0x7fd045), match (0x7fd076), lua_replace (0x7fd0be) |
0x7fd0e0 | str_gsub | maximum count luaL_optnumber (0x7fd12f), anchor ^ (0x7fd13c), string or function expected (0x7fd189), add_s (0x7fd203) |
0x7fd2a0 | add_s | lua_isstring (0x7fd2b8), % handling (0x7fd2f0), check_capture, push_onecapture, lua_call (0x7fd38d) |
The derivation is in the doc.
Callers 0
None by a direct call or jump.
Callees 8
- __ftol crt
- lua_replace lua
- lua_tonumber lua
- lua_tostring lua
- lua_strlen lua
- lua_pushnumber lua
- match lua
- push_captures lua
Calls and jumps by a bare address, from tables/calls.tsv.