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

Method test_lua_boolchunk

crawl-ref/source/mapdef.cc:2673–2706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2671}
2672
2673bool map_def::test_lua_boolchunk(dlua_chunk &chunk, bool defval,
2674 bool die_on_lua_error)
2675{
2676 bool result = defval;
2677 dlua_set_map mset(this);
2678
2679 int err = chunk.load(dlua);
2680 if (err == E_CHUNK_LOAD_FAILURE)
2681 return result;
2682 else if (err)
2683 {
2684 if (die_on_lua_error)
2685 end(1, false, "Lua error: %s", chunk.orig_error().c_str());
2686 else
2687 mprf(MSGCH_ERROR, "Lua error: %s", chunk.orig_error().c_str());
2688 return result;
2689 }
2690 if (dlua.callfn("dgn_run_map", 1, 1))
2691 dlua.fnreturns(">b", &result);
2692 else
2693 {
2694 if (die_on_lua_error)
2695 {
2696 end(1, false, "Lua error: %s",
2697 rewrite_chunk_errors(dlua.error).c_str());
2698 }
2699 else
2700 {
2701 mprf(MSGCH_ERROR, "Lua error: %s",
2702 rewrite_chunk_errors(dlua.error).c_str());
2703 }
2704 }
2705 return result;
2706}
2707
2708bool map_def::test_lua_validate(bool croak)
2709{

Callers

nothing calls this directly

Calls 6

endFunction · 0.85
mprfFunction · 0.85
orig_errorMethod · 0.80
fnreturnsMethod · 0.80
loadMethod · 0.45
callfnMethod · 0.45

Tested by

no test coverage detected