feat(lua/util): remove dependency on luaL_setfuncs

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(lua): allow Lean to be compiled with Lua 5.1 and LuaJit

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(FindLua.cmake): search also for LuaJit

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
fix(shell/lua): catch lean exceptions in the leanlua frontend

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(lua): add safe_function template that catches Lean and C++ exceptions and convert them into Lua errors

I'm using the approach described at:
http://stackoverflow.com/questions/4615890/how-to-handle-c-exceptions-when-calling-functions-from-lua

BTW, in some Lua versions, the C++ exceptions are correctly propagated.
I think we should not rely on features of particular implementations.
For example, LuaJIT does not propagate C++ exceptions.
Whenever an exception is thrown from C++ code invoked from LuaJit, LuaJit interrupts the execution and converts it to an error "C++ exception".
On the other hand, Lua 5.2 PUC-Rio interpreter (for Ubuntu) seem to propagate the C++ exceptions.
The template safe_function solves the issue. It will also produce a Lua error whenever the function being wrapped throws an exception. The error message is based on the "what()" method.

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>