/usr/share/doc/sludge/SLUDGEDevKitHelp/Variables.html is in sludge-doc 2.2.1-1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<TITLE>Variables</TITLE>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<BODY>
<HR>
<div align="center"><img id="headerGraphic" src="images/sludge300.png" alt="SLUDGE"/></div>
<h2>Variables</h2>
<HR>
<P>
SLUDGE has only one variable structure - the "var" - which can hold many different types of data. The different data types which can be held in a SLUDGE variable are:
</P>
<P>
<B>Undefined:</B>
</P>
<P>
Not much use, but it's the value to which variables are initialised, and the default return value from user defined functions.
</P>
<P>
<B>Numbers:</B>
</P>
<P>
For those of you who know C or C++, they're long signed integers. For everyone else, they're big but they can't do decimal points. Whoever heard of an adventure game saying "It's a bag of 482.66666666667 gold coins"?
</P>
<P>
<B>Strings:</B>
</P>
<P>
Used for holding text. All of the other data types can be turned into strings automatically, making debugging a lot simpler - see the <a href="Treating_Variables_as_Strings.html">Treating Variables as Strings</a> page.
</P>
<P>
<B>File handles:</B>
</P>
<P>
How do you get a picture, sound, sprite bank or floor into your code? Here's how. Read up on these in the <a href="File_Handling.html">File Handling</a> section.
</P>
<P>
<B>Object types:</B>
</P>
<P>
Objects, actions and characters. More information on creating and using these is available in the <a href="Object_Types_and_Events.html">Object Types and Events</a> section.
</P>
<P>
<B>Stacks:</B>
</P>
<P>
These double as arrays, but you don't have to set any boundaries. Stacks can hold any number (including 0) of other variables of any - or mixed - data types. And yes, that includes other stacks. See the section about <a href="The_Multi-Purpose_Stack___Array___Queue_Type.html">The Multi-Purpose Stack / Array / Queue Type</a> for more information.
</P>
<P>
<B>Function handles:</B>
</P>
<P>
Pass a function around like a variable! Fun, fun, fun. There's <a href="Passing_Functions_as_Variables.html">more information here</a>.
</P>
<P>
<B>Animations:</B>
</P>
<P>
Created using the <a href="anim.html">anim</a> function.
</P>
<P>
<B>Costumes:</B>
</P>
<P>
Created using the <a href="costume.html">costume</a> function.
</P>
<H3>Local and global variables:</H3>
<P>
Variables can be local or global. Local variables (defined inside a function) exist for only the duration of the <a href="Functions_(subs).html">function</a> in which they are defined; global variables (defined outside of all the functions) are accessible to everything. For example:
</P>
<P>
<pre>var thisIsGlobal = 5;
sub someFunction () {
var thisIsLocal = 10;
say (ego, thisIsGlobal + thisIsLocal);
# Fine
}
sub someOtherFunction () {
say (ego, thisIsGlobal + thisIsLocal);
# Not fine... in this function we have no idea what "thisIsLocal" is
}</pre>
</P>
<H3>More on this subject:</H3>
<P>
<a href="Treating_Variables_as_Booleans.html">Treating Variables as Booleans</a>
</P>
<P>
<a href="Treating_Variables_as_Strings.html">Treating Variables as Strings</a>
</P>
<P>
<a href="The_Multi-Purpose_Stack___Array___Queue_Type.html">The Multi-Purpose Stack / Array / Queue Type</a>
</P>
<P>
<a href="Variable_Operations.html">Variable Operations</a>
</P>
<P class="copyright-notice">SLUDGE and this SLUDGE documentation are <A HREF="Copyright.html">copyright</A> Hungry Software and contributors 2000-2012
</P>
<HR>
</BODY>
</html>
|