lua function should use passed in lua state not global lua state