local:moodlescript:language:setmapping
MoodleScript: SET MAPPING
MoodleScript Script Engine
Effect
Initialises a lookup table of keys to values. This makes it possible to feed transcription tables into the engine, for example to transform codes into labels. The variable list stops at the first empty line. The first space after the first “:” is omitted in the value.
Syntax
SET MAPPING <mapname> HAVING key1: value 1 key2: value 2
Exemples
SET MAPPING codevilles HAVING BEZI: Béziers CARC: Carcassonne NARB: Narbonne PERP: Perpignan SETE: Sète
Specific attributes
- mapname: The name of the table to create, without spaces or special characters.
Notes
The created variable is installed in the global context of the execution stack for the lifetime of the script, until it is overridden by another assignment.
Calling mapped values
Using mapped variables is an extension of the moodlescript “variables” syntax. To access a mapped value, use the syntax:
:mapname[keyname]
Example:
:codevilles[BEZI]
Other defaults
local/moodlescript/language/setmapping.txt · Dernière modification : de 127.0.0.1
