Home
Author Manual
Themes Guide
Development

foreign-variables

Foreign Variables are the variables that are not defined in any module but whose value can be defined by application (like FPM). It’s value is populated by application during interpreter’s runtime.

Motivation Behind Foreign Variables

If application wants to provide value to any data variable at runtime, so they can use foreign variables.

It can be used to fetch data provided by application.

fpm/time.now-str

foo.ftd
-- import: fpm/time

-- ftd.text: $time.now-str

The -- import: fpm/time statement exposes foreign variable fpm/time.now-str which returns the current date and time as a string.

The output looks something like this

Mon Jun 13 15:08:18 IST 2022