MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / contextLoad

Method contextLoad

source/core/StarLua.cpp:961–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

959}
960
961void LuaEngine::contextLoad(int handleIndex, char const* contents, size_t size, char const* name) {
962 lua_checkstack(m_state, 2);
963
964 // First load the script...
965 handleError(m_state, luaL_loadbuffer(m_state, contents, size, name));
966
967 // Then set the _ENV upvalue for the newly loaded chunk to our context env so
968 // we load the scripts into the right environment.
969 pushHandle(m_state, handleIndex);
970 lua_setupvalue(m_state, -2, 1);
971
972 incrementRecursionLevel();
973 int res = pcallWithTraceback(m_state, 0, 0);
974 decrementRecursionLevel();
975 handleError(m_state, res);
976}
977
978LuaDetail::LuaFunctionReturn LuaEngine::contextEval(int handleIndex, String const& lua) {
979 int stackSize = lua_gettop(m_state);

Callers 1

loadMethod · 0.80

Calls 2

lua_checkstackFunction · 0.85
lua_setupvalueFunction · 0.85

Tested by

no test coverage detected