MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / getnum

Function getnum

extlibs/lua/src/lstrlib.c:1404–1414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1402static int digit (int c) { return '0' <= c && c <= '9'; }
1403
1404static int getnum (const char **fmt, int df) {
1405 if (!digit(**fmt)) /* no number? */
1406 return df; /* return default value */
1407 else {
1408 int a = 0;
1409 do {
1410 a = a*10 + (*((*fmt)++) - '0');
1411 } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10);
1412 return a;
1413 }
1414}
1415
1416
1417/*

Callers 2

getnumlimitFunction · 0.85
getoptionFunction · 0.85

Calls 1

digitFunction · 0.70

Tested by

no test coverage detected