MCPcopy Create free account
hub / github.com/crawl/crawl / load

Method load

crawl-ref/source/dlua.cc:151–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151int dlua_chunk::load(CLua &interp)
152{
153 if (!compiled.empty())
154 {
155 return check_op(interp,
156 interp.loadbuffer(compiled.c_str(), compiled.length(),
157 context.c_str()));
158 }
159
160 if (empty())
161 {
162 chunk.clear();
163 return E_CHUNK_LOAD_FAILURE;
164 }
165
166 int err = check_op(interp,
167 interp.loadstring(chunk.c_str(), context.c_str()));
168 if (err)
169 return err;
170 ostringstream out;
171 err = lua_dump(interp, dlua_compiled_chunk_writer, &out, 0);
172 if (err)
173 {
174 const char *e = lua_tostring(interp, -1);
175 error = e? e : "Unknown error compiling chunk";
176 lua_pop(interp, 2);
177 }
178 compiled = out.str();
179 return err;
180}
181
182int dlua_chunk::run(CLua &interp)
183{

Callers 5

handle_monster_dies_luaFunction · 0.45
readMethod · 0.45
_write_vaultFunction · 0.45
_restore_gameFunction · 0.45

Calls 6

loadbufferMethod · 0.80
loadstringMethod · 0.80
emptyFunction · 0.50
emptyMethod · 0.45
clearMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected