NetLogo 7.0.0-beta2 User Manual: Resource Extension

Resource

Using

Purpose

The resource extension allows you to retrieve the contents of files that are bundled with a model. Bundled resources, which were added in NetLogo 7, provide a way to use the contents of other files in a model without needing to send the files alongside the model. When you add a resource to a model, the contents of the source file are stored in the model file.

For details on bundled resources, see Resource Manager.

Getting Started

The resource extension comes pre-installed with NetLogo. To use the resource extension in your model, add a line to the top of your Code tab:

extensions [resource]

If your model already uses other extensions, then it already has an extensions line in it, so just add resource to the list.

For more information on using NetLogo extensions, see the Extensions Guide

Primitives

#
resource:get resource:list

resource:get

resource:get name

Reports the contents of the resource whose name matches the input string. If the resource is plain text, the contents will be reported as such. Otherwise, the contents will be reported as a Base64 string. An error will be thrown if the specified resource does not exist.

resource:list

resource:list

Reports a list of names of the bundled resources present in the model.