app_lua: search for for lua 5.1 compilation flags

- lua 5.2 embedded api is not compatible with 5.1
- an upgrade to c code in app_lua is required, till then, lua-5.1 has to
  be installed (can co-exist with lua 5.2)

(cherry picked from commit 04da8d891cdf1314e24cf025b64ed1cc70ce7b5e)