MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / g_write

Function g_write

Source/Misc/lua/src/lua.c:12324–12340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12322
12323
12324static int g_write (lua_State *L, FILE *f, int arg) {
12325int nargs = lua_gettop(L) - 1;
12326int status = 1;
12327for (; nargs--; arg++) {
12328if (lua_type(L, arg) == LUA_TNUMBER) {
12329/* optimization: could be done exactly as for strings */
12330status = status &&
12331fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0;
12332}
12333else {
12334size_t l;
12335const char *s = luaL_checklstring(L, arg, &l);
12336status = status && (fwrite(s, sizeof(char), l, f) == l);
12337}
12338}
12339return pushresult(L, status, NULL);
12340}
12341
12342
12343static int io_write (lua_State *L) {

Callers 2

io_writeFunction · 0.85
f_writeFunction · 0.85

Calls 5

lua_gettopFunction · 0.85
lua_typeFunction · 0.85
lua_tonumberFunction · 0.85
luaL_checklstringFunction · 0.85
pushresultFunction · 0.85

Tested by

no test coverage detected