lua: Add ability to detect any suitable version of Lua

The lua module requires lua >= 5.1.4, but on some systems, the
pkg-config module is called lua, not lua5.1. To support this, test for
the existence of lua, lua5.2, and then lua5.1, and use the first found
to compare the version against.

Reported-by: Peter Czanik <czanik@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
lua: Add support for lua5.2

lua_open() was deprecated in lua5.1, use luaL_newstate() instead, which
exists in both.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>