MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / l_strton

Function l_strton

third-party/lua-5.5.0/src/lvm.c:91–101  ·  view source on GitHub ↗

** Try to convert a value from string to a number value. ** If the value is not a string or is a string not representing ** a valid numeral (or if coercions from strings to numbers ** are disabled via macro 'cvt2num'), do not modify 'result' ** and return 0. */

Source from the content-addressed store, hash-verified

89** and return 0.
90*/
91static int l_strton (const TValue *obj, TValue *result) {
92 lua_assert(obj != result);
93 if (!cvt2num(obj)) /* is object not a string? */
94 return 0;
95 else {
96 TString *st = tsvalue(obj);
97 size_t stlen;
98 const char *s = getlstr(st, stlen);
99 return (luaO_str2num(s, result) == stlen + 1);
100 }
101}
102
103
104/*

Callers 2

luaV_tonumber_Function · 0.70
luaV_tointegerFunction · 0.70

Calls 1

luaO_str2numFunction · 0.70

Tested by

no test coverage detected