MCPcopy Create free account
hub / github.com/DFHack/dfhack / init_run_script

Function init_run_script

library/Core.cpp:314–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312}
313
314static bool init_run_script(color_ostream &out, lua_State *state, const std::string_view pcmd, const std::span<const std::string> pargs)
315{
316 if (!lua_checkstack(state, pargs.size()+10))
317 return false;
318 Lua::PushDFHack(state);
319 lua_getfield(state, -1, "run_script");
320 lua_remove(state, -2);
321 lua_pushlstring(state, pcmd.data(), pcmd.size());
322 for (const auto& arg : pargs)
323 lua_pushstring(state, arg.c_str());
324 return true;
325}
326
327static command_result runLuaScript(color_ostream &out, const std::string_view name, const std::span<const std::string> args)
328{

Callers 1

runLuaScriptFunction · 0.85

Calls 7

lua_checkstackFunction · 0.85
lua_getfieldFunction · 0.85
lua_pushlstringFunction · 0.85
lua_pushstringFunction · 0.85
c_strMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected