MCPcopy Create free account
hub / github.com/Tencent/UnLua / io_write

Function io_write

Plugins/UnLuaExtensions/LuaProtobuf/Source/src/pb.cpp:535–544  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533}
534
535static int io_write(lua_State *L, FILE *f, int idx) {
536 int nargs = lua_gettop(L) - idx + 1;
537 int status = 1;
538 for (; nargs--; idx++) {
539 pb_Slice s = lpb_checkslice(L, idx);
540 size_t l = pb_len(s);
541 status = status && (fwrite(s.p, sizeof(char), l, f) == l);
542 }
543 return status ? 1 : luaL_fileresult(L, 0, NULL);
544}
545
546static int Lio_read(lua_State *L) {
547 const char *fname = luaL_optstring(L, 1, NULL);

Callers 2

Lio_writeFunction · 0.70
Lio_dumpFunction · 0.70

Calls 4

lua_gettopFunction · 0.85
lpb_checksliceFunction · 0.85
pb_lenFunction · 0.85
luaL_fileresultFunction · 0.70

Tested by

no test coverage detected