ROPE Language Reference - "greg"

The "greg" action returns a reference to one of the available global registers (greg stands for "global register"). It takes an integer value off the stack and returns a reference to the numbered global integer register. You can use this reference to get or put their values.

Rope "global registers" are integer registers who's values are available to all Rope scripts (ie "public") via the "greg" action, and to "user" mode programs via files in the /proc file system. The values are not reset between Rope script executions.

Note that..

Getting A Global Register Value

To get the contents of global register number 5..

5 greg get print
greg(5) get print
greg(5) print

The last of these examples works because many of Rope's actions (including print) execute an implied get when they are passed a register reference.

Setting A Global Register Value

To setthe value of global register number 5 to value 29, use one of..

put( 29 greg(5) )
29 greg(5) put
29 5 greg put

Change History

The "greg" action is not available in Rope versions before 20050101 (Jan 2005).

See Also

get, put, reg