MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / g_write

Function g_write

third-party/lua-5.2.4/src/liolib.c:514–531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512
513
514static int g_write (lua_State *L, FILE *f, int arg) {
515 int nargs = lua_gettop(L) - arg;
516 int status = 1;
517 for (; nargs--; arg++) {
518 if (lua_type(L, arg) == LUA_TNUMBER) {
519 /* optimization: could be done exactly as for strings */
520 status = status &&
521 fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
522 }
523 else {
524 size_t l;
525 const char *s = luaL_checklstring(L, arg, &l);
526 status = status && (fwrite(s, sizeof(char), l, f) == l);
527 }
528 }
529 if (status) return 1; /* file handle already on stack top */
530 else return luaL_fileresult(L, status, NULL);
531}
532
533
534static int io_write (lua_State *L) {

Callers 2

io_writeFunction · 0.70
f_writeFunction · 0.70

Calls 5

lua_gettopFunction · 0.70
lua_typeFunction · 0.70
luaL_checklstringFunction · 0.70
luaL_fileresultFunction · 0.70
lua_tonumberFunction · 0.50

Tested by

no test coverage detected