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

Function run

plugins/blueprint.cpp:1729–1750  ·  view source on GitHub ↗

entrypoint when called from Lua. returns the names of the generated files

Source from the content-addressed store, hash-verified

1727
1728// entrypoint when called from Lua. returns the names of the generated files
1729static int run(lua_State *L) {
1730 int argc = lua_gettop(L);
1731 vector<string> argv;
1732
1733 for (int i = 1; i <= argc; ++i) {
1734 const char *s = lua_tostring(L, i);
1735 if (s == NULL)
1736 luaL_error(L, "all parameters must be strings");
1737 argv.push_back(s);
1738 }
1739
1740 vector<string> files;
1741 color_ostream *out = Lua::GetOutput(L);
1742 if (!out)
1743 out = &Core::getInstance().getConsole();
1744 if (CR_OK == do_blueprint(*out, argv, files)) {
1745 Lua::PushVector(L, files);
1746 return 1;
1747 }
1748
1749 return 0;
1750}
1751
1752command_result blueprint(color_ostream &out, vector<string> &parameters) {
1753 vector<string> files;

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
luaL_errorFunction · 0.85
do_blueprintFunction · 0.85
PushVectorFunction · 0.85

Tested by

no test coverage detected