First, I recommend using the Script Manager to handle scripts. The easiest way to do this is to put it in a file.
Create a file scripts/myscript.lua and put the update function in there: elem.property(tpt.el.sprk.id, "Update", function(i) sim.partProperty(i, "life", 4) end)
It's better to write it in a file because it often doesn't fit in the console. Once you have the file, open the script manager and load it.
The wiki will list all the functions you can use to interact with the particle.