<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://drl.chaosforge.org/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://drl.chaosforge.org/w/index.php?action=history&amp;feed=atom&amp;title=Modding%3Aweighttable</id>
		<title>Modding:weighttable - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://drl.chaosforge.org/w/index.php?action=history&amp;feed=atom&amp;title=Modding%3Aweighttable"/>
		<link rel="alternate" type="text/html" href="https://drl.chaosforge.org/w/index.php?title=Modding:weighttable&amp;action=history"/>
		<updated>2026-04-16T13:25:58Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.1</generator>

	<entry>
		<id>https://drl.chaosforge.org/w/index.php?title=Modding:weighttable&amp;diff=2609&amp;oldid=prev</id>
		<title>Shark20061: Created page with &quot;Weight tables are objects that choose an object from a list at random, using the provided weights as the relative probably for each choice.  == Weight Table API ==  ;{{moddef|des...&quot;</title>
		<link rel="alternate" type="text/html" href="https://drl.chaosforge.org/w/index.php?title=Modding:weighttable&amp;diff=2609&amp;oldid=prev"/>
				<updated>2013-06-11T17:13:51Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;Weight tables are objects that choose an object from a list at random, using the provided weights as the relative probably for each choice.  == Weight Table API ==  ;{{moddef|des...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Weight tables are objects that choose an object from a list at random, using the provided weights as the relative probably for each choice.&lt;br /&gt;
&lt;br /&gt;
== Weight Table API ==&lt;br /&gt;
&lt;br /&gt;
;{{moddef|desc|weight_table.new||weight_table}}&lt;br /&gt;
Creates a new, empty weight table.&lt;br /&gt;
:'''Returns''': A reference to an empty weight table.&lt;br /&gt;
----&lt;br /&gt;
;{{moddef|desc|add|cln||&amp;lt;any&amp;gt;|object|integer|[weight]}}&lt;br /&gt;
Adds an item to the weighttable.&lt;br /&gt;
:''object'': The thing to add.&lt;br /&gt;
:''weight'': ''Optional.'' The weight to use for this object.  If omitted, the object's own weight property will be used, or 1 is used if the object doesn't have a weight property.&lt;br /&gt;
----&lt;br /&gt;
;{{moddef|desc|size|cln}}&lt;br /&gt;
Gets the number of elements in this weight table.&lt;br /&gt;
:'''Returns''': The number of elements in the table.&lt;br /&gt;
----&lt;br /&gt;
;{{moddef|desc|roll|cln}}&lt;br /&gt;
Picks an object at random from the table using the indicated weights.&lt;br /&gt;
:'''Returns''': An object rolled at random.&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Weight Table Object ==&lt;br /&gt;
&lt;br /&gt;
{{drltable|Properties |3|{{Table3Col&lt;br /&gt;
  |es=background: #333;&lt;br /&gt;
  |c1=font-family:monospace; text-align:right; vertical-align:top; padding:0px 2px;&lt;br /&gt;
  |c2=vertical-align:top; padding:0px 2px;&lt;br /&gt;
  |c3=padding:0px 2px;&lt;br /&gt;
  |_elements|{{modarg|table}}|The list of elements in the weight table.&lt;br /&gt;
  |_weights|{{modarg|table}}|The weights of each corresponding element.&lt;br /&gt;
  |_weight|{{modarg|integer}}|The total weight of all elements in the table.&lt;br /&gt;
  }}&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Shark20061</name></author>	</entry>

	</feed>