How to connect a function in lua