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

Function tostringbuff

extlibs/lua/src/lobject.c:343–356  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

341** Convert a number object to a string, adding it to a buffer
342*/
343static int tostringbuff (TValue *obj, char *buff) {
344 int len;
345 lua_assert(ttisnumber(obj));
346 if (ttisinteger(obj))
347 len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj));
348 else {
349 len = lua_number2str(buff, MAXNUMBER2STR, fltvalue(obj));
350 if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */
351 buff[len++] = lua_getlocaledecpoint();
352 buff[len++] = '0'; /* adds '.0' to result */
353 }
354 }
355 return len;
356}
357
358
359/*

Callers 2

luaO_tostringFunction · 0.85
addnum2buffFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected