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

Function lua_load

extlibs/sol3/include/sol/sol.hpp:2832–2847  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2830}
2831
2832COMPAT53_API int lua_load(lua_State *L, lua_Reader reader, void *data, const char *source, const char *mode) {
2833 int status = LUA_OK;
2834 compat53_reader_data compat53_data = { reader, data, 1, 0, 0 };
2835 compat53_data.peeked_data = reader(L, data, &(compat53_data.peeked_data_size));
2836 if (compat53_data.peeked_data && compat53_data.peeked_data_size &&
2837 compat53_data.peeked_data[0] == LUA_SIGNATURE[0]) /* binary file? */
2838 status = compat53_checkmode(L, mode, "binary", LUA_ERRSYNTAX);
2839 else
2840 status = compat53_checkmode(L, mode, "text", LUA_ERRSYNTAX);
2841 if (status != LUA_OK)
2842 return status;
2843 /* we need to call the original 5.1 version of lua_load! */
2844#undef lua_load
2845 return lua_load(L, compat53_reader, &compat53_data, source);
2846#define lua_load COMPAT53_CONCAT(COMPAT53_PREFIX, _load_53)
2847}
2848
2849typedef struct {
2850 int n; /* number of pre-read characters */

Callers 5

luaL_loadfilexFunction · 0.70
scriptFunction · 0.70
do_readerMethod · 0.70
unsafe_scriptMethod · 0.70
loadMethod · 0.70

Calls 2

readerFunction · 0.85
compat53_checkmodeFunction · 0.85

Tested by

no test coverage detected