fixed compilation on recent compiler/system, better lua detection