MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_compilex

Function lua_compilex

src/Chain/libraries/glua/lapi.cpp:1070–1100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1068}
1069
1070LUA_API int lua_compilex(lua_State *L, lua_Reader reader, void *dt,
1071 const char *chunkname, const char *mode, lua_Writer writer, const char *out_filename)
1072{
1073 FILE *f = fopen(out_filename, "wb");
1074 if (nullptr == f)
1075 {
1076 perror("compile out file not found");
1077 return LUA_ERRERR;
1078 }
1079
1080 struct FileReleaseScope {
1081 FILE *_f;
1082 FileReleaseScope(FILE *f) : _f(f) { }
1083 ~FileReleaseScope() {
1084 if (ferror(_f))
1085 {
1086 perror("write");
1087 }
1088 if (fclose(_f))
1089 {
1090 perror("close");
1091 }
1092 }
1093 } file_release_scope(f);
1094
1095 int status = lua_compile(L, reader, dt, chunkname, mode, writer, f);
1096 if (status) {
1097 return status;
1098 }
1099 return LUA_OK;
1100}
1101
1102
1103LUA_API int lua_dump(lua_State *L, lua_Writer writer, void *data, int strip) {

Callers 1

luaL_compilefileFunction · 0.85

Calls 1

lua_compileFunction · 0.85

Tested by

no test coverage detected