Outils pour utilisateurs

Outils du site


local:moodlescript:language:setvariable

MoodleScript: SET VARIABLE

MoodleScript Script Engine

Effect

Initialises a context key with a value or with the value of another variable.

Syntax

  SET VARIABLE <varname> FROM <litteral>
  SET VARIABLE <varname> FROM :<varname>
  SET VARIABLE <varname> FROM Litterals with :{<varname>} inside

Examples

  SET VARIABLE defautname FROM Default
  SET VARIABLE savedcourseid FROM :courseid
  SET VARIABLE extendeddefaultname FROM :{courseid}_with_extensions

Attributs particuliers

  • varname: The name of the variable to create, without spaces or special characters.
  • litteral: A literal string

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.

When a variable is created from another variable, the latter must be defined in the global context of the script, otherwise an empty value will initialise the new variable.

A combined literal form can call existing context variables. Sub-variable calls are replaced by those found in the context at execution time.

Other defaults

local/moodlescript/language/setvariable.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki