Added helper function to HMLuaVisitor

simplified some things