SetGlobal (System subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (That is a function, not a variable.)
 
(12 intermediate revisions by 2 users not shown)
Line 6: Line 6:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><var>%(System)</var></th>
<tr><th><var class="nobr">%(System)</var></th>
<td>The class name in parentheses denotes a ÝÝNotation conventions for methods#Shared methods|shared]] method. <var>SetGlobal</var> can also be invoked via a <var>System</var> object variable, which may be <var>Null</var>.</td></tr>
<td>The class name in parentheses denotes a [[Notation conventions for methods#Shared methods|shared]] method. <var>SetGlobal</var> can also be invoked via a <var>System</var> object variable, which may be <var>Null</var>.</td></tr>
<tr><th>name</th>
<tr><th>name</th>
<td>A string that identifies the global to be set.</td></tr>
<td>A string that identifies the global to be set.</td></tr>
Line 15: Line 15:


==Usage notes==
==Usage notes==
<ul><li>All errors result in request cancellation.
<ul>
<li>All errors result in request cancellation.
 
<li>It is not an error to set a global that is not set.
<li>It is not an error to set a global that is not set.
<li>Like <var>[[$Setg_Sys]]</var>, the <var>SetGlobal</var> method momentarily turns off multi-processing, so should not be used heavily in an <var class="product">MP/204</var> environment. <var>[[SetString_(System_function)|SetString]]</var> does not suffer this limitation and should be used in these situations.
 
<li>Like <var>[[$Setg_Sys]]</var>, the <var>SetGlobal</var> method momentarily turns off multi-processing, so should not be used heavily in an <var class="product">MP/204</var> environment. <var>[[SetString_(System_function)|SetString]]</var> does not suffer this limitation and should be used in these situations.
</ul>
</ul>


==Examples==
==Examples==
The following statement sets the system global called CHOLERIC:
The following statement sets the system global called <code>CHOLERIC</code>:
<p class="code">%(system):setGlobal('CHOLERIC', 'ANGRY')</p>
<p class="code">%(system):setGlobal('CHOLERIC', 'ANGRY')</p>


==See also==
==See also==
<ul><li>The <var>setGlobal</var> method, in the <var>System</var> class, performs a function identical to the <var>[[$Setg_Sys|$setg_sys]]</var> function. That is, the following two statements are identical:
<ul>
<li>The <var>setGlobal</var> method, in the <var>System</var> class, performs a function identical to the <var>[[$Setg_Sys|$setg_sys]]</var> function. That is, the following two statements are identical:
<p class="code">%(system):setGlobal('PHLEGMATIC', 'STOLID')
<p class="code">%(system):setGlobal('PHLEGMATIC', 'STOLID')
%setg_sys('PHLEGMATIC', 'STOLID')</p>
%rc = $setg_sys('PHLEGMATIC', 'STOLID')</p>
<li>For more information about system  globals, see [[System_class#System_and_subsystem_globals_and_strings|&amp;amp;#x201C;System globals and strings&amp;amp;#x201D;]].</ul>
 
<li>For more information about system  globals, see [[System_class#System_and_subsystem_globals_and_strings|"System and SubSystem globals and strings"]].
</ul>
 
{{Template:System:SetGlobal footer}}
{{Template:System:SetGlobal footer}}

Latest revision as of 22:06, 12 December 2014

Set a system-wide global (System class)

The SetGlobal shared subroutine sets a system-wide global.

Syntax

%(System):SetGlobal( name, value)

Syntax terms

%(System) The class name in parentheses denotes a shared method. SetGlobal can also be invoked via a System object variable, which may be Null.
name A string that identifies the global to be set.
value A string that identifies the new value for the global.

Usage notes

  • All errors result in request cancellation.
  • It is not an error to set a global that is not set.
  • Like $Setg_Sys, the SetGlobal method momentarily turns off multi-processing, so should not be used heavily in an MP/204 environment. SetString does not suffer this limitation and should be used in these situations.

Examples

The following statement sets the system global called CHOLERIC:

%(system):setGlobal('CHOLERIC', 'ANGRY')

See also

  • The setGlobal method, in the System class, performs a function identical to the $setg_sys function. That is, the following two statements are identical:

    %(system):setGlobal('PHLEGMATIC', 'STOLID') %rc = $setg_sys('PHLEGMATIC', 'STOLID')

  • For more information about system globals, see "System and SubSystem globals and strings".