redo some of the lua stuff to modify Elements instead of ptypes, and keep both up to date

todo: tried a script and it was broken ... but tests in the console all worked