summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/initfile.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r--crawl-ref/source/initfile.cc25
1 files changed, 11 insertions, 14 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index cdf8a4f810..717446b8e0 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -1158,8 +1158,8 @@ void game_options::read_options(InitLineInput &il, bool runscript)
{
#ifdef CLUA_BINDINGS
clua.execstring(luacode.c_str());
- if (clua.error.length())
- fprintf(stderr, "Lua error: %s\n", clua.error.c_str());
+ if (!clua.error.empty())
+ mprf(MSGCH_WARN, "Lua error: %s\n", clua.error.c_str());
luacode.clear();
#endif
}
@@ -1173,9 +1173,8 @@ void game_options::read_options(InitLineInput &il, bool runscript)
if (runscript)
{
clua.execstring(luacode.c_str());
- if (clua.error.length())
- fprintf(stderr, "Lua error: %s\n",
- clua.error.c_str());
+ if (!clua.error.empty())
+ mprf(MSGCH_WARN, "Lua error: %s\n", clua.error.c_str());
}
#endif
luacode.clear();
@@ -1208,10 +1207,8 @@ void game_options::read_options(InitLineInput &il, bool runscript)
if (l_init)
luacond += "]] )\n";
clua.execstring(luacond.c_str());
- if (clua.error.length())
- {
- mpr( ("Lua error: " + clua.error).c_str() );
- }
+ if (!clua.error.empty())
+ mprf(MSGCH_WARN, "Lua error: %s\n", clua.error.c_str());
}
#endif
@@ -1571,8 +1568,8 @@ void game_options::read_option_line(const std::string &str, bool runscript)
else
{
clua.execfile(lua_file.c_str());
- if (clua.error.length())
- fprintf(stderr, "Lua error: %s\n", clua.error.c_str());
+ if (!clua.error.empty())
+ mprf(MSGCH_WARN, "Lua error: %s\n", clua.error.c_str());
}
#endif
}
@@ -2452,7 +2449,7 @@ void game_options::read_option_line(const std::string &str, bool runscript)
pickup_mode = read_bool_or_number(field, pickup_mode, "auto:");
}
// Catch-all else, copies option into map
- else
+ else if (runscript)
{
#ifdef CLUA_BINDINGS
if (!clua.callbooleanfn(false, "c_process_lua_option", "ss",
@@ -2460,8 +2457,8 @@ void game_options::read_option_line(const std::string &str, bool runscript)
#endif
{
#ifdef CLUA_BINDINGS
- if (clua.error.length())
- mpr(clua.error.c_str());
+ if (!clua.error.empty())
+ mprf(MSGCH_WARN, "Lua error: %s\n", clua.error.c_str());
#endif
named_options[key] = orig_field;
}