This page is also available in the other languages: English Deutsch

Packages

Import packages into your script to get access to functions and types.

Packages helps you to do common tasks faster and easier. There is a wide range of packages available to you in scripts.

A package is imported by using the import statement and the name of the package.

1var time = import("time")

The result of the import statement is then stored in the variable time.

You can use any name for this variable. But it is good practices to use the package name here.

You can import multiple packages in one line of code as well.

1var time, log = import("time"), import("log")

The functions and types from a package can then accessed via the variable. For example, if you want to get the current date and time, you call the function Now() from the time package.

1var time = import("time")
2time.Now()

On This Page
© Matthias Hochgatterer – MastodonGithubRésumé