This is weird.
I’m not very good with makefile code, but by reading the makefile i’d think that your lua should be detected, based on this:
LUA_CANDIDATES = lua5.2 lua-5.2 lua5.1 lua-5.1 lua
LUA_FOUND = $(firstword $(foreach lua,$(LUA_CANDIDATES),\
$(shell if $(PKG_CONFIG) --silence-errors --exists $(lua); then echo $(lua);fi)))
LUA_PKG += $(if $(LUA_FOUND),$(LUA_FOUND),$(error "Lua not found by $(PKG_CONFIG), install it or make without 'LUA=1'"))
Which means (if i understand correctly): search serially for the lua variants (and we do know that the “lua” one exists), and if none exist, error out.
Maybe the problem is with pkg_config or its $PATH?
is this responding with “lua”?
Anyway, i do think you’d need someone with a bit more knowledge than me to debug it.