summaryrefslogtreecommitdiff
path: root/library/Core.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-06-14 12:46:12 +0400
committerAlexander Gavrilov2012-06-14 12:46:12 +0400
commit7eb4fc19de542db0d3e271123f24773e0c8c481e (patch)
tree027f53970a8333eac7e33079c297c7b87754a333 /library/Core.cpp
parent2781723f7bf2bef87b7c6c5252aebd6392cbefbf (diff)
downloaddfhack-7eb4fc19de542db0d3e271123f24773e0c8c481e.tar.gz
dfhack-7eb4fc19de542db0d3e271123f24773e0c8c481e.tar.bz2
dfhack-7eb4fc19de542db0d3e271123f24773e0c8c481e.tar.xz
Make dfhack.run_script usable from other scripts, and document it.
Diffstat (limited to 'library/Core.cpp')
-rw-r--r--library/Core.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/library/Core.cpp b/library/Core.cpp
index 620fc81d..a1090450 100644
--- a/library/Core.cpp
+++ b/library/Core.cpp
@@ -264,16 +264,12 @@ static bool init_run_script(color_ostream &out, lua_State *state, void *info)
return true;
}
-static command_result runLuaScript(color_ostream &out, std::string filename, vector<string> &args)
+static command_result runLuaScript(color_ostream &out, std::string name, vector<string> &args)
{
ScriptArgs data;
- data.pcmd = &filename;
+ data.pcmd = &name;
data.pargs = &args;
-#ifndef LINUX_BUILD
- filename = toLower(filename);
-#endif
-
bool ok = Lua::RunCoreQueryLoop(out, Lua::Core::State, init_run_script, &data);
return ok ? CR_OK : CR_FAILURE;
@@ -619,7 +615,7 @@ command_result Core::runCommand(color_ostream &con, const std::string &first, ve
{
auto filename = getHackPath() + "scripts/" + first + ".lua";
if (fileExists(filename))
- res = runLuaScript(con, filename, parts);
+ res = runLuaScript(con, first, parts);
else
con.printerr("%s is not a recognized command.\n", first.c_str());
}