porting command t to lua