LTspice does not link to external programs or code. But it has a capable
user-programmable component in the form of the BI behavioral element. It
is a current-output device. If you can write an expression for what you
want the current to be, using the rules listed in the Help file, you can
create a BI element that does it.
Take a look in the Help utility under LTspice > Circuit Elements > B.
Arbitrary Behavioral Voltage or Current Sources. The Help for Dot Commands
.FUNC and Dot Commands > .PARAM may also be useful.
Regards,
Andy