lua: removing duplicated code from vesa.c