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

Function tonumeral

lib/lua/src/lcode.c:56–68  ·  view source on GitHub ↗

** If expression is a numeric constant, fills 'v' with its value ** and returns 1. Otherwise, returns 0. */

Source from the content-addressed store, hash-verified

54** and returns 1. Otherwise, returns 0.
55*/
56static int tonumeral (const expdesc *e, TValue *v) {
57 if (hasjumps(e))
58 return 0; /* not a numeral */
59 switch (e->k) {
60 case VKINT:
61 if (v) setivalue(v, e->u.ival);
62 return 1;
63 case VKFLT:
64 if (v) setfltvalue(v, e->u.nval);
65 return 1;
66 default: return 0;
67 }
68}
69
70
71/*

Callers 5

luaK_exp2constFunction · 0.85
constfoldingFunction · 0.85
codearithFunction · 0.85
codecommutativeFunction · 0.85
luaK_infixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected