updating code to use lua