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

Function tostringbuff

lib/lua/src/lobject.c:355–368  ·  view source on GitHub ↗

** Convert a number object to a string, adding it to a buffer */

Source from the content-addressed store, hash-verified

353** Convert a number object to a string, adding it to a buffer
354*/
355static int tostringbuff (TValue *obj, char *buff) {
356 int len;
357 lua_assert(ttisnumber(obj));
358 if (ttisinteger(obj))
359 len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj));
360 else {
361 len = lua_number2str(buff, MAXNUMBER2STR, fltvalue(obj));
362 if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */
363 buff[len++] = lua_getlocaledecpoint();
364 buff[len++] = '0'; /* adds '.0' to result */
365 }
366 }
367 return len;
368}
369
370
371/*

Callers 2

luaO_tostringFunction · 0.85
addnum2buffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected