for F4, you can only use custom build firmware, to include C++ scripting function. Otherwise you cannot use LUA scripting.
Scripting is not available in F4 based autopilots. Autopilots must have an SD card to store the script unless the user builds his own firmware and embeds it directly in the firmware.