luaL_optnumber
function · lua · boundary
- Address
0x6f4cd0· 42 bytes, up to0x6f4cf9- Meaning
- Returns the number of an argument or a default for an absent one
- Confidence
- verified, proof one
- Finding
- lua/auxlib#argument-checks
Finding: Argument checks in lua: the auxiliary library
Argument errors go through luaL_argerror, which names the function from lua_getinfo and raises
with luaL_error: bad argument #%d to `%s' (%s), or calling `%s' on bad self (%s) when the
name kind is method. luaL_typerror and tag_error make the X expected, got Y message from a type
name or tag. The checks are luaL_checktype, luaL_checkany, luaL_checkstack,
luaL_checklstring, luaL_checknumber and the optional forms luaL_optlstring and
luaL_optnumber. luaL_where pushes chunk:line: of a call level.
| function | name | decided by |
|---|---|---|
0x6f4810 | luaL_argerror | lua_getstack (0x6f4824), lua_getinfo (0x6f4834), the text method (0x6f483c), the two formats |
0x6f48a0 | luaL_typerror | lua_type, lua_typename (0x6f48b2), the format %s expected, got %s (0x6f48bc) |
0x6f48e0 | luaL_where | lua_getstack (0x6f48ed), lua_getinfo with Snl (0x6f48fa), the format %s:%d: (0x6f4912) |
0x6f4b20 | luaL_checkstack | lua_checkstack (0x6f4b26), the format stack overflow (%s) (0x6f4b33) |
0x6f4b50 | luaL_checktype | lua_type compared with the argument (0x6f4b59), tag_error (0x6f4b6a) |
0x6f4b80 | tag_error | lua_typename (0x6f4b8c) then luaL_typerror (0x6f4b96) |
0x6f4bb0 | luaL_checkany | lua_type equal to -1 (0x6f4bbb), the text value expected (0x6f4bc0) |
0x6f4be0 | luaL_checklstring | lua_tostring (0x6f4bea), tag_error with tag 4 (0x6f4bfb), lua_strlen (0x6f4c0b) |
0x6f4c20 | luaL_optlstring | lua_type above 0 selects luaL_checklstring (0x6f4c6a), else the default and its length (0x6f4c40) |
0x6f4c80 | luaL_checknumber | lua_tonumber (0x6f4c8c), lua_isnumber only when it is 0.0 (0x6f4ca7), tag_error with tag 3 (0x6f4cb6) |
0x6f4cd0 | luaL_optnumber | lua_type (0x6f4cd9) selects luaL_checknumber (0x6f4cef) or the default |
The derivation is in the doc.
Callers 11
- ScriptError ui
- ScriptPushFunction ui
- ScriptToNumber ui
- ScriptCollectGarbage ui
- ScriptDate ui
- luaB_tremove lua
- str_concat lua
- str_sub lua
- str_byte lua
- str_find lua
- str_gsub lua
Callees 2
- lua_type lua
- luaL_checknumber lua
Calls and jumps by a bare address, from tables/calls.tsv.