MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / skipcomment

Function skipcomment

3rd/lua-5.4.3/src/lauxlib.c:763–773  ·  view source on GitHub ↗

** reads the first character of file 'f' and skips an optional BOM mark ** in its beginning plus its first line if it starts with '#'. Returns ** true if it skipped the first line. In any case, '*cp' has the ** first "valid" character of the file (after the optional BOM and ** a first-line comment). */

Source from the content-addressed store, hash-verified

761** a first-line comment).
762*/
763static int skipcomment (LoadF *lf, int *cp) {
764 int c = *cp = skipBOM(lf);
765 if (c == '#') { /* first line is a comment (Unix exec. file)? */
766 do { /* skip first line */
767 c = getc(lf->f);
768 } while (c != EOF && c != '\n');
769 *cp = getc(lf->f); /* skip end-of-line, if present */
770 return 1; /* there was a comment */
771 }
772 else return 0; /* no comment */
773}
774
775
776LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename,

Callers 1

luaL_loadfilexFunction · 0.85

Calls 1

skipBOMFunction · 0.85

Tested by

no test coverage detected