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

Function PrintConstant

extlibs/lua/src/luac.c:295–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293}
294
295static void PrintConstant(const Proto* f, int i)
296{
297 const TValue* o=&f->k[i];
298 switch (ttypetag(o))
299 {
300 case LUA_VNIL:
301 printf("nil");
302 break;
303 case LUA_VFALSE:
304 printf("false");
305 break;
306 case LUA_VTRUE:
307 printf("true");
308 break;
309 case LUA_VNUMFLT:
310 {
311 char buff[100];
312 sprintf(buff,LUA_NUMBER_FMT,fltvalue(o));
313 printf("%s",buff);
314 if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0");
315 break;
316 }
317 case LUA_VNUMINT:
318 printf(LUA_INTEGER_FMT,ivalue(o));
319 break;
320 case LUA_VSHRSTR:
321 case LUA_VLNGSTR:
322 PrintString(tsvalue(o));
323 break;
324 default: /* cannot happen */
325 printf("?%d",ttypetag(o));
326 break;
327 }
328}
329
330#define COMMENT "\t; "
331#define EXTRAARG GETARG_Ax(code[pc+1])

Callers 2

PrintCodeFunction · 0.85
PrintDebugFunction · 0.85

Calls 3

printfFunction · 0.85
sprintfFunction · 0.85
PrintStringFunction · 0.85

Tested by

no test coverage detected