Can I turn a C++ source code of a element into a Lua code for a new element?
I don't think so, but im not qualified to give a deliberate yes or no. C++ and Lua are quite different from what I know about them. If you want to make a mod, just learn either Lua or C++ and their respective APIs for TPT modding.