Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Add Dependency

Add a dependency to your project by using acton pkg add and providing the URL to the project and a local reference name.

In this case we add the example foo package as a dependency.

acton pkg add https://github.com/actonlang/foo/archive/refs/heads/main.zip foo

This will fetch the dependency and add it to the dependencies block in Build.act, resulting in something like:

dependencies = {
  "foo": (
        url="https://github.com/actonlang/foo/archive/refs/heads/main.zip",
        hash="1220cd47344f8a1e7fe86741c7b0257a63567b4c17ad583bddf690eedd672032abdd",
    ),
}

zig_dependencies = {}

Note

It is possible to edit Build.act by hand, but adding dependencies requires filling in the hash field, which is somewhat tricky.

The foo package provides a single foo module with a foo function (that appropriately returns foo). We can now access it from our main actor:

import foo

actor main(env):
    print(foo.foo())
    env.exit(0)