Hide Lua functions from remaining C++ code.

Instead of checking defined(LUA) and than calling Lua functions, the code unconditionally calls wrapper functions.
The wrapper functions are implemented in catalua.cpp and are either empty (non-Lua builds) or refer to the actual Lua function.
Concentrate and refine Lua error reporting:

Add a single function that reports errors.

Check global Lua state pointer before using it, just in case Lua wasn't initialized.

Use wrapper lua_dofile instead of luaL_dofile, as it reports errors.
Add wrapper to pass strings for format specifiers from Lua to C++

Lua might send strings containing "%s" or similar, which would be interpreted by popup and add_msg, and both functions would expect further parameters, which Lua does not provide.
Add compatibility for Lua 5.2

Lua 5.1 is still supported.