static int push(lua_State* state, const LuaCodeChunkResult& ref) { int status = luaL_loadstring(state, ref.code_.c_str()); if (!except::checkErrorAndThrow(status, state)) { return 0; } status = lua_pcall_wrap(state, 0, 1); if (!except::checkErrorAndThrow(status, state)) { return 0; } return 1; }
static int push(lua_State* state, const LuaCodeChunkExecute& ref) { int status = luaL_loadbuffer(state, ref.code_.c_str(), ref.code_.size(), ref.chunk_name_.empty()? ref.code_.c_str(): ref.chunk_name_.c_str()); if (!except::checkErrorAndThrow(status, state)) { return 0; } status = lua_pcall_wrap(state, 0, 1); if (!except::checkErrorAndThrow(status, state)) { return 0; } return 1; }