User Tools

Site Tools


Sidebar

Passage markup

basics

coding

extra

list

section

whitespace

Macros

basics

colour

data structure

date and time

game state

live

maths

number

revision

saving

showing and hiding

string

styling

url

deprecated

Types of data

Special keywords

Special passage tags

harlowe:dataentries

(dataentries: datamap) → array

This takes a datamap, and returns an array of its name/value pairs. Each pair is a datamap that only has “name” and “value” data. The pairs are ordered by their name.

Example usage:

  • (datapairs: (dm:'B',24, 'A',25)) produces the following array:

(a: (dm: "name", "A", "value", 25), (dm: "name", "B", "value", 24))

  • (altered: _entry via _entry's name + ":" + _entry's value, ...(datapairs: $m)) creates

an array of string from the $m datamap's names and values.

Rationale:

There are occasions where operating on just the names, or the values, of a datamap isn't good enough - you'll want both. Rather than the verbose process of taking the (datanames:) and (datavalues:) arrays and using them (interlaced:) with each other, you can use this macro instead, which allows the name and value of each entry to be referenced using “name” and “value” properties.

See also:

harlowe/dataentries.txt · Last modified: 2017/10/10 00:39 (external edit)