MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / lua_load

Function lua_load

Libs/sol/sol.hpp:3349–3363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3347}
3348
3349COMPAT53_API int lua_load(lua_State* L, lua_Reader reader, void* data, const char* source, const char* mode) {
3350 int status = LUA_OK;
3351 compat53_reader_data compat53_data = { reader, data, 1, 0, 0 };
3352 compat53_data.peeked_data = reader(L, data, &(compat53_data.peeked_data_size));
3353 if (compat53_data.peeked_data && compat53_data.peeked_data_size && compat53_data.peeked_data[0] == LUA_SIGNATURE[0]) /* binary file? */
3354 status = compat53_checkmode(L, mode, "binary", LUA_ERRSYNTAX);
3355 else
3356 status = compat53_checkmode(L, mode, "text", LUA_ERRSYNTAX);
3357 if (status != LUA_OK)
3358 return status;
3359 /* we need to call the original 5.1 version of lua_load! */
3360#undef lua_load
3361 return lua_load(L, compat53_reader, &compat53_data, source);
3362#define lua_load COMPAT53_CONCAT(COMPAT53_PREFIX, _load_53)
3363}
3364
3365typedef struct {
3366 int n; /* number of pre-read characters */

Callers 5

luaL_loadfilexFunction · 0.85
scriptFunction · 0.85
do_readerMethod · 0.85
unsafe_scriptMethod · 0.85
loadMethod · 0.85

Calls 1

compat53_checkmodeFunction · 0.85

Tested by

no test coverage detected