buildsystem: properly check for a working lua version

Signed-off-by: Andrew 'Necromant' Andrianov <andrew@ncrmnt.org>