MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / l_strton

Function l_strton

lib/lua/src/lvm.c:100–108  ·  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

98** and return 0.
99*/
100static int l_strton (const TValue *obj, TValue *result) {
101 lua_assert(obj != result);
102 if (!cvt2num(obj)) /* is object not a string? */
103 return 0;
104 else {
105 TString *st = tsvalue(obj);
106 return (luaO_str2num(getstr(st), result) == tsslen(st) + 1);
107 }
108}
109
110
111/*

Callers 2

luaV_tonumber_Function · 0.85
luaV_tointegerFunction · 0.85

Calls 1

luaO_str2numFunction · 0.85

Tested by

no test coverage detected