refactor(lua): remove duplicate code, separate lua_exception, add missing #pragma once

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
feat(lua): add Consts function

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>