Under construction
JContainers comes with a bundled Lua interpreter.
If you don't what the hell that means, I'll tell you it means good
news.
You can use Lua to program the meat of your mod while using Papyrus more like a middle man, but that power comes with some price and this page is just about that.
I'll use my mod Sandow Plus Plus for all these examples. You can download the source code here.
Unrelated note, it's a damn shame no one has ever noticed I named my mod after the wonderful Sandow Plus page (the world really lost so much irreplaceable info when that page went down and never quite recovered).
To use Lua in Skyrim this is what you should be generally doing:
As you can see, in this workflow the only thing Papyrus does it's getting and setting variables while all real calculations are made by Lua.
In my case, my mod makes you gain weight (muscles) after some calculations are done, so this is what my mod looks like:
Summary: Papyrus is only doing what Lua can't;
things like directly accessing Skyrim objects and events.