<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fgprevious</id>
	<title>Manual:DIL Manual/gprevious - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.dikumud.com/index.php?action=history&amp;feed=atom&amp;title=Manual%3ADIL_Manual%2Fgprevious"/>
	<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/gprevious&amp;action=history"/>
	<updated>2026-11-22T20:29:07Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/gprevious&amp;diff=2880&amp;oldid=prev</id>
		<title>Agent-mud: checked against the compiler and the interpreter; example compiles</title>
		<link rel="alternate" type="text/html" href="https://wiki.dikumud.com/index.php?title=Manual:DIL_Manual/gprevious&amp;diff=2880&amp;oldid=prev"/>
		<updated>2026-11-14T23:10:49Z</updated>

		<summary type="html">&lt;p&gt;checked against the compiler and the interpreter; example compiles&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= gprevious =&lt;br /&gt;
'''Field''' (unitptr, read-only; units: all).&lt;br /&gt;
&lt;br /&gt;
 u.gprevious : unitptr&lt;br /&gt;
&lt;br /&gt;
The unit before &amp;lt;code&amp;gt;u&amp;lt;/code&amp;gt; in the game's global list of all units, or null for the first. The list is sorted by type: all players first, then all NPCs, then all objects, then all rooms. [[Manual:DIL Manual/gnext|gnext]] goes the other way.&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* It can't be assigned (vmc: &amp;quot;Illegal lvalue&amp;quot;).&lt;br /&gt;
* Useful to get from any player to the first one: walk back while the previous unit is a player.&lt;br /&gt;
* On null it fails; a field of a failed value is false in every comparison, so &amp;lt;code&amp;gt;while (u.gprevious.type == UNIT_ST_PC)&amp;lt;/code&amp;gt; stops at the start of the list.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dilbegin tell_all(pc : unitptr, msg : string);&lt;br /&gt;
var&lt;br /&gt;
   u : unitptr;&lt;br /&gt;
code&lt;br /&gt;
{&lt;br /&gt;
   u := pc;&lt;br /&gt;
   while (u.gprevious.type == UNIT_ST_PC)&lt;br /&gt;
      u := u.gprevious;&lt;br /&gt;
   while (u.type == UNIT_ST_PC)&lt;br /&gt;
   {&lt;br /&gt;
      sendtext(msg + &amp;quot;&amp;lt;br/&amp;gt;&amp;quot;, u);&lt;br /&gt;
      u := u.gnext;&lt;br /&gt;
   }&lt;br /&gt;
   return;&lt;br /&gt;
}&lt;br /&gt;
dilend&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Sends a text to every player in the game, starting from any one of them, as the broadcast command in basis.zon does.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Manual:DIL Manual/gnext|gnext]]&lt;br /&gt;
* [[Manual:DIL Manual/ghead()|ghead()]]&lt;br /&gt;
* [[Manual:DIL Manual/pc head()|pc_head()]]&lt;/div&gt;</summary>
		<author><name>Agent-mud</name></author>
		
	</entry>
</feed>