MCPcopy Create free account
hub / github.com/DFHack/dfhack / PrintConstant

Function PrintConstant

depends/lua/src/luac.c:254–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252}
253
254static void PrintConstant(const Proto* f, int i)
255{
256 const TValue* o=&f->k[i];
257 switch (ttype(o))
258 {
259 case LUA_TNIL:
260 printf("nil");
261 break;
262 case LUA_TBOOLEAN:
263 printf(bvalue(o) ? "true" : "false");
264 break;
265 case LUA_TNUMFLT:
266 {
267 char buff[100];
268 sprintf(buff,LUA_NUMBER_FMT,fltvalue(o));
269 printf("%s",buff);
270 if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0");
271 break;
272 }
273 case LUA_TNUMINT:
274 printf(LUA_INTEGER_FMT,ivalue(o));
275 break;
276 case LUA_TSHRSTR: case LUA_TLNGSTR:
277 PrintString(tsvalue(o));
278 break;
279 default: /* cannot happen */
280 printf("? type=%d",ttype(o));
281 break;
282 }
283}
284
285#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-")
286#define MYK(x) (-1-(x))

Callers 2

PrintCodeFunction · 0.85
PrintDebugFunction · 0.85

Calls 1

PrintStringFunction · 0.85

Tested by

no test coverage detected