Only print the shortcut help once in the lua interactive mode.

develop
Alexander Gavrilov 2012-04-01 17:00:25 +04:00
parent afe4eba957
commit edd63080b5
2 changed files with 12 additions and 6 deletions

@ -225,11 +225,16 @@ bool DFHack::Lua::InterpreterLoop(color_ostream &out, lua_State *state,
DFHack::CommandHistory hist;
hist.load(hfile);
out.print("Type quit to exit interactive lua interpreter.\n"
"Shortcuts:\n"
" '= foo' => '_1,_2,... = foo'\n"
" '! foo' => 'print(foo)'\n"
"Both assign the first result to '_'\n");
out.print("Type quit to exit interactive lua interpreter.\n");
static bool print_banner = true;
if (print_banner) {
out.print("Shortcuts:\n"
" '= foo' => '_1,_2,... = foo'\n"
" '! foo' => 'print(foo)'\n"
"Both save the first result as '_'.\n");
print_banner = false;
}
Console &con = static_cast<Console&>(out);
@ -305,7 +310,7 @@ bool DFHack::Lua::InterpreterLoop(color_ostream &out, lua_State *state,
{
if (!load_with_env(out, state, curline, base))
continue;
if (!SafeCall(out, state, 0, LUA_MULTRET))
if (!SafeCall(out, state, 0, 0))
continue;
}
}

@ -26,6 +26,7 @@ function reload(module)
end
function printall(table)
if table == nil then return end
for k,v in pairs(table) do
print(k," = "..tostring(v))
end