c++ migration to lua