File: script_reference.html

package info (click to toggle)
treesheets 1%3A1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,744 kB
  • sloc: cpp: 42,518; makefile: 66; ansic: 9
file content (243 lines) | stat: -rw-r--r-- 60,608 bytes parent folder | download | duplicates (2)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>lobster builtin function reference</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">table.a, tr.a, td.a {font-size: 10pt;border: 1pt solid #DDDDDD; border-Collapse: collapse; max-width:1200px}</style>
</head>
<body><center><table border=0><tr><td>
<p>lobster builtin functions:(file auto generated by compiler, do not modify)</p>

<h3>treesheets</h3>
<table class="a" border=1 cellspacing=0 cellpadding=4>
<tr class="a" valign=top><td class="a"><tt><b>ts_goto_root</b>()</tt></td><td class="a">makes the root of the document the current cell. this is the default at the startof any script, so this function is only needed to return there.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_goto_view</b>()</tt></td><td class="a">makes what the user has zoomed into the current cell.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_has_selection</b>() -> <font color="#666666">int</font></tt></td><td class="a">wether there is a selection.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_goto_selection</b>()</tt></td><td class="a">makes the current cell the one containing the selection, or does nothing on noselection.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_has_parent</b>() -> <font color="#666666">int</font></tt></td><td class="a">wether the current cell has a parent (is the root cell).</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_goto_parent</b>()</tt></td><td class="a">makes the current cell the parent of the current cell, if any.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_num_children</b>() -> <font color="#666666">int</font></tt></td><td class="a">returns the total number of children of the current cell (rows * columns).returns 0 if this cell doesn't have a sub-grid at all.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_num_columns_rows</b>() -> <font color="#666666">xy_i</font></tt></td><td class="a">returns the number of columns & rows in the current cell.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_selection</b>() -> <font color="#666666">xy_i</font>, <font color="#666666">xy_i</font></tt></td><td class="a">returns the (x,y) and (xs,ys) of the current selection, or zeroes if none.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_goto_child</b>(n<font color="#666666">:int</font>)</tt></td><td class="a">makes the current cell the nth child of the current cell.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_goto_column_row</b>(col<font color="#666666">:int</font>, row<font color="#666666">:int</font>)</tt></td><td class="a">makes the current cell the child at col / row.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_get_text</b>() -> <font color="#666666">string</font></tt></td><td class="a">gets the text of the current cell.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_set_text</b>(text<font color="#666666">:string</font>)</tt></td><td class="a">sets the text of the current cell.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_create_grid</b>(cols<font color="#666666">:int</font>, rows<font color="#666666">:int</font>)</tt></td><td class="a">creates a grid in the current cell if there isn't one yet.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_insert_columns</b>(c<font color="#666666">:int</font>, n<font color="#666666">:int</font>)</tt></td><td class="a">insert n columns before column c in an existing grid.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_insert_rows</b>(r<font color="#666666">:int</font>, n<font color="#666666">:int</font>)</tt></td><td class="a">insert n rows before row r in an existing grid.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_delete</b>(pos<font color="#666666">:xy_i</font>, size<font color="#666666">:xy_i</font>)</tt></td><td class="a">clears the cells denoted by pos/size. also removes columns/rows if they becomecompletely empty, or the entire grid.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_set_background_color</b>(col<font color="#666666">:xyzw_f</font>)</tt></td><td class="a">sets the background color of the current cell</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_set_text_color</b>(col<font color="#666666">:xyzw_f</font>)</tt></td><td class="a">sets the text color of the current cell</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_set_relative_size</b>(s<font color="#666666">:int</font>)</tt></td><td class="a">sets the relative size (0 is normal, -1 is smaller etc.) of the current cell</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_set_style_bits</b>(s<font color="#666666">:int</font>)</tt></td><td class="a">sets one or more styles (bold = 1, italic = 2, fixed = 4, underline = 8, strikethru = 16) on the current cell.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_set_status_message</b>(msg<font color="#666666">:string</font>)</tt></td><td class="a">sets the status message in TreeSheets.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ts_get_filename_from_user</b>(is_save<font color="#666666">:int</font>) -> <font color="#666666">string</font></tt></td><td class="a">gets a filename using a file dialog. empty string if cancelled.</td></tr>
</table>
<h3>builtin</h3>
<table class="a" border=1 cellspacing=0 cellpadding=4>
<tr class="a" valign=top><td class="a"><tt><b>print</b>(x<font color="#666666">:string</font>)</tt></td><td class="a">output any value to the console (with linefeed).</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>string</b>(x<font color="#666666">:string</font>) -> <font color="#666666">string</font></tt></td><td class="a">convert any value to string</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_print_depth</b>(depth<font color="#666666">:int</font>)</tt></td><td class="a">for printing / string conversion: sets max vectors/objects recursion depth (default 10)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_print_length</b>(len<font color="#666666">:int</font>)</tt></td><td class="a">for printing / string conversion: sets max string length (default 100000)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_print_quoted</b>(quoted<font color="#666666">:bool</font>)</tt></td><td class="a">for printing / string conversion: if the top level value is a string, whether to convert it with escape codes and quotes (default false)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_print_decimals</b>(decimals<font color="#666666">:int</font>)</tt></td><td class="a">for printing / string conversion: number of decimals for any floating point output (default -1, meaning all)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_print_indent</b>(spaces<font color="#666666">:int</font>)</tt></td><td class="a">for printing / string conversion: number of spaces to indent with. default is 0: no indent / no multi-line</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>get_line</b>() -> <font color="#666666">string</font></tt></td><td class="a">reads a string from the console if possible (followed by enter)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>if</b>(cond<font color="#666666"></font>, then<font color="#666666">:function</font>, else<font color="#666666">:function</font> = nil) -> <font color="#666666">any</font></tt></td><td class="a">evaluates then or else depending on cond, else is optional</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>while</b>(cond<font color="#666666">:function</font>, do<font color="#666666">:function</font>) -> <font color="#666666">any</font></tt></td><td class="a">evaluates body while cond (converted to a function) holds true, returns last body value</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>for</b>(iter<font color="#666666"></font>, do<font color="#666666">:function</font>)</tt></td><td class="a">iterates over int/vector/string, body may take [ element [ , index ] ] arguments</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>append</b>(xs<font color="#666666">:[any]</font>, ys<font color="#666666">:[any]</font>) -> <font color="#666666">[any]</font></tt></td><td class="a">creates a new vector by appending all elements of 2 input vectors</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>vector_reserve</b>(typeid<font color="#666666">:typeid</font>, len<font color="#666666">:int</font>) -> <font color="#666666">[any]</font></tt></td><td class="a">creates a new empty vector much like [] would, except now ensures it will have space for len push() operations without having to reallocate. pass "typeof return" as typeid.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>length</b>(x<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">length of int (identity function, useful in combination with string/vector version)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>length</b>(s<font color="#666666">:string</font>) -> <font color="#666666">int</font></tt></td><td class="a">length of string</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>length</b>(xs<font color="#666666">:[any]</font>) -> <font color="#666666">int</font></tt></td><td class="a">length of vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>equal</b>(a<font color="#666666"></font>, b<font color="#666666"></font>) -> <font color="#666666">int</font></tt></td><td class="a">structural equality between any two values (recurses into vectors/objects, unlike == which is only true for vectors/objects if they are the same object)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>push</b>(xs<font color="#666666">:[any]</font>, x<font color="#666666"></font>) -> <font color="#666666">[any]</font></tt></td><td class="a">appends one element to a vector, returns existing vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>pop</b>(xs<font color="#666666">:[any]</font>) -> <font color="#666666">any</font></tt></td><td class="a">removes last element from vector and returns it</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>top</b>(xs<font color="#666666">:[any]</font>) -> <font color="#666666">any</font></tt></td><td class="a">returns last element from vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>insert</b>(xs<font color="#666666">:[any]</font>, i<font color="#666666">:int</font>, x<font color="#666666"></font>) -> <font color="#666666">[any]</font></tt></td><td class="a">inserts a value into a vector at index i, existing elements shift upward, returns original vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>remove</b>(xs<font color="#666666">:[any]</font>, i<font color="#666666">:int</font>, n<font color="#666666">:int</font> = 0) -> <font color="#666666">any</font></tt></td><td class="a">remove element(s) at index i, following elements shift down. pass the number of elements to remove as an optional argument, default 1. returns the first element removed.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>remove_obj</b>(xs<font color="#666666">:[any]</font>, obj<font color="#666666"></font>) -> <font color="#666666">any</font></tt></td><td class="a">remove all elements equal to obj (==), returns obj.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>binary_search</b>(xs<font color="#666666">:[int]</font>, key<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">does a binary search for key in a sorted vector, returns as first return value how many matches were found, and as second the index in the array where the matches start (so you can read them, overwrite them, or remove them), or if none found, where the key could be inserted such that the vector stays sorted. This overload is for int vectors and keys.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>binary_search</b>(xs<font color="#666666">:[float]</font>, key<font color="#666666">:float</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">float version.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>binary_search</b>(xs<font color="#666666">:[string]</font>, key<font color="#666666">:string</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">string version.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>copy</b>(xs<font color="#666666"></font>) -> <font color="#666666">any</font></tt></td><td class="a">makes a shallow copy of any object.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>slice</b>(xs<font color="#666666">:[any]</font>, start<font color="#666666">:int</font>, size<font color="#666666">:int</font>) -> <font color="#666666">[any]</font></tt></td><td class="a">returns a sub-vector of size elements from index start. size can be negative to indicate the rest of the vector.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>any</b>(xs<font color="#666666">:vec_i</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns wether any elements of the numeric struct are true values</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>any</b>(xs<font color="#666666">:[any]</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns wether any elements of the vector are true values</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>all</b>(xs<font color="#666666">:vec_i</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns wether all elements of the numeric struct are true values</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>all</b>(xs<font color="#666666">:[any]</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns wether all elements of the vector are true values</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>substring</b>(s<font color="#666666">:string</font>, start<font color="#666666">:int</font>, size<font color="#666666">:int</font>) -> <font color="#666666">string</font></tt></td><td class="a">returns a substring of size characters from index start. size can be negative to indicate the rest of the string.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>string_to_int</b>(s<font color="#666666">:string</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">converts a string to an int. returns 0 if no numeric data could be parsed.second return value is true if all characters of the string were parsed</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>string_to_float</b>(s<font color="#666666">:string</font>) -> <font color="#666666">float</font></tt></td><td class="a">converts a string to a float. returns 0.0 if no numeric data could be parsed</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>tokenize</b>(s<font color="#666666">:string</font>, delimiters<font color="#666666">:string</font>, whitespace<font color="#666666">:string</font>) -> <font color="#666666">[string]</font></tt></td><td class="a">splits a string into a vector of strings, by splitting into segments upon each dividing or terminating delimiter. Segments are stripped of leading and trailing whitespace. Example: "; A ; B C; " becomes [ "", "A", "B C" ] with ";" as delimiter and " " as whitespace.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>unicode_to_string</b>(us<font color="#666666">:[int]</font>) -> <font color="#666666">string</font></tt></td><td class="a">converts a vector of ints representing unicode values to a UTF-8 string.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>string_to_unicode</b>(s<font color="#666666">:string</font>) -> <font color="#666666">[int]?</font></tt></td><td class="a">converts a UTF-8 string into a vector of unicode values, or nil upon a decoding error</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>number_to_string</b>(number<font color="#666666">:int</font>, base<font color="#666666">:int</font>, minchars<font color="#666666">:int</font>) -> <font color="#666666">string</font></tt></td><td class="a">converts the (unsigned version) of the input integer number to a string given the base (2..36, e.g. 16 for hex) and outputting a minimum of characters (padding with 0).</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>lowercase</b>(s<font color="#666666">:string</font>) -> <font color="#666666">string</font></tt></td><td class="a">converts a UTF-8 string from any case to lower case, affecting only A-Z</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>uppercase</b>(s<font color="#666666">:string</font>) -> <font color="#666666">string</font></tt></td><td class="a">converts a UTF-8 string from any case to upper case, affecting only a-z</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>escape_string</b>(s<font color="#666666">:string</font>, set<font color="#666666">:string</font>, prefix<font color="#666666">:string</font>, postfix<font color="#666666">:string</font>) -> <font color="#666666">string</font></tt></td><td class="a">prefixes & postfixes any occurrences or characters in set in string s</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>concat_string</b>(v<font color="#666666">:[string]</font>, sep<font color="#666666">:string</font>) -> <font color="#666666">string</font></tt></td><td class="a">concatenates all elements of the string vector, separated with sep.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>repeat_string</b>(s<font color="#666666">:string</font>, n<font color="#666666">:int</font>) -> <font color="#666666">string</font></tt></td><td class="a">returns a string consisting of n copies of the input string.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>pow</b>(a<font color="#666666">:float</font>, b<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">a raised to the power of b</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>pow</b>(a<font color="#666666">:int</font>, b<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">a raised to the power of b, for integers, using exponentiation by squaring</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>pow</b>(a<font color="#666666">:vec_f</font>, b<font color="#666666">:float</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">vector elements raised to the power of b</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>log</b>(a<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">natural logaritm of a</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sqrt</b>(f<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">square root</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ceiling</b>(f<font color="#666666">:float</font>) -> <font color="#666666">int</font></tt></td><td class="a">the nearest int >= f</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ceiling</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">the nearest ints >= each component of v</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>floor</b>(f<font color="#666666">:float</font>) -> <font color="#666666">int</font></tt></td><td class="a">the nearest int <= f</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>floor</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">the nearest ints <= each component of v</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>int</b>(f<font color="#666666">:float</font>) -> <font color="#666666">int</font></tt></td><td class="a">converts a float to an int by dropping the fraction</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>int</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">converts a vector of floats to ints by dropping the fraction</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>round</b>(f<font color="#666666">:float</font>) -> <font color="#666666">int</font></tt></td><td class="a">converts a float to the closest int. same as int(f + 0.5), so does not work well on negative numbers</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>round</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">converts a vector of floats to the closest ints</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>fraction</b>(f<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">returns the fractional part of a float: short for f - int(f)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>fraction</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">returns the fractional part of a vector of floats</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>float</b>(i<font color="#666666">:int</font>) -> <font color="#666666">float</font></tt></td><td class="a">converts an int to float</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>float</b>(v<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">converts a vector of ints to floats</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sin</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">the y coordinate of the normalized vector indicated by angle (in degrees)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>cos</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">the x coordinate of the normalized vector indicated by angle (in degrees)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>tan</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">the tangent of an angle (in degrees)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sincos</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">xy_f</font></tt></td><td class="a">the normalized vector indicated by angle (in degrees), same as xy { cos(angle), sin(angle) }</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>asin</b>(y<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">the angle (in degrees) indicated by the y coordinate projected to the unit circle</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>acos</b>(x<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">the angle (in degrees) indicated by the x coordinate projected to the unit circle</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>atan</b>(x<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">the angle (in degrees) indicated by the y coordinate of the tangent projected to the unit circle</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>radians</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">converts an angle in degrees to radians</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>degrees</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">converts an angle in radians to degrees</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>atan2</b>(vec<font color="#666666">:vec_f</font>) -> <font color="#666666">float</font></tt></td><td class="a">the angle (in degrees) corresponding to a normalized 2D vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>radians</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">converts an angle in degrees to radians</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>degrees</b>(angle<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">converts an angle in radians to degrees</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>normalize</b>(vec<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">returns a vector of unit length</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>dot</b>(a<font color="#666666">:vec_f</font>, b<font color="#666666">:vec_f</font>) -> <font color="#666666">float</font></tt></td><td class="a">the length of vector a when projected onto b (or vice versa)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>magnitude</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">float</font></tt></td><td class="a">the geometric length of a vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>manhattan</b>(v<font color="#666666">:vec_i</font>) -> <font color="#666666">int</font></tt></td><td class="a">the manhattan distance of a vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>cross</b>(a<font color="#666666">:xyz_f</font>, b<font color="#666666">:xyz_f</font>) -> <font color="#666666">xyz_f</font></tt></td><td class="a">a perpendicular vector to the 2D plane defined by a and b (swap a and b for its inverse)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>rnd</b>(max<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">a random value [0..max).</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>rnd</b>(max<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">a random vector within the range of an input vector.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>rnd_float</b>() -> <font color="#666666">float</font></tt></td><td class="a">a random float [0..1)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>rnd_gaussian</b>() -> <font color="#666666">float</font></tt></td><td class="a">a random float in a gaussian distribution with mean 0 and stddev 1</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>rnd_seed</b>(seed<font color="#666666">:int</font>)</tt></td><td class="a">explicitly set a random seed for reproducable randomness</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>div</b>(a<font color="#666666">:int</font>, b<font color="#666666">:int</font>) -> <font color="#666666">float</font></tt></td><td class="a">forces two ints to be divided as floats</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>clamp</b>(x<font color="#666666">:int</font>, min<font color="#666666">:int</font>, max<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">forces an integer to be in the range between min and max (inclusive)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>clamp</b>(x<font color="#666666">:float</font>, min<font color="#666666">:float</font>, max<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">forces a float to be in the range between min and max (inclusive)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>clamp</b>(x<font color="#666666">:vec_i</font>, min<font color="#666666">:vec_i</font>, max<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">forces an integer vector to be in the range between min and max (inclusive)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>clamp</b>(x<font color="#666666">:vec_f</font>, min<font color="#666666">:vec_f</font>, max<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">forces a float vector to be in the range between min and max (inclusive)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>in_range</b>(x<font color="#666666">:int</font>, range<font color="#666666">:int</font>, bias<font color="#666666">:int</font> = 0) -> <font color="#666666">int</font></tt></td><td class="a">checks if an integer is >= bias and < bias + range. Bias defaults to 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>in_range</b>(x<font color="#666666">:float</font>, range<font color="#666666">:float</font>, bias<font color="#666666">:float</font> = 0) -> <font color="#666666">int</font></tt></td><td class="a">checks if a float is >= bias and < bias + range. Bias defaults to 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>in_range</b>(x<font color="#666666">:vec_i</font>, range<font color="#666666">:vec_i</font>, bias<font color="#666666">:vec_i</font> = nil) -> <font color="#666666">int</font></tt></td><td class="a">checks if a 2d/3d integer vector is >= bias and < bias + range. Bias defaults to 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>in_range</b>(x<font color="#666666">:vec_f</font>, range<font color="#666666">:vec_f</font>, bias<font color="#666666">:vec_f</font> = nil) -> <font color="#666666">int</font></tt></td><td class="a">checks if a 2d/3d float vector is >= bias and < bias + range. Bias defaults to 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>abs</b>(x<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">absolute value of an integer</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>abs</b>(x<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">absolute value of a float</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>abs</b>(x<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">absolute value of an int vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>abs</b>(x<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">absolute value of a float vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sign</b>(x<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">sign (-1, 0, 1) of an integer</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sign</b>(x<font color="#666666">:float</font>) -> <font color="#666666">int</font></tt></td><td class="a">sign (-1, 0, 1) of a float</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sign</b>(x<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">signs of an int vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>sign</b>(x<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">signs of a float vector</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(x<font color="#666666">:int</font>, y<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">smallest of 2 integers.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(x<font color="#666666">:float</font>, y<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">smallest of 2 floats.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(x<font color="#666666">:vec_i</font>, y<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">smallest components of 2 int vectors</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(x<font color="#666666">:vec_f</font>, y<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">smallest components of 2 float vectors</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(v<font color="#666666">:vec_i</font>) -> <font color="#666666">int</font></tt></td><td class="a">smallest component of a int vector.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">float</font></tt></td><td class="a">smallest component of a float vector.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(v<font color="#666666">:[int]</font>) -> <font color="#666666">int</font></tt></td><td class="a">smallest component of a int vector, or INT_MAX if length 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>min</b>(v<font color="#666666">:[float]</font>) -> <font color="#666666">float</font></tt></td><td class="a">smallest component of a float vector, or FLT_MAX if length 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(x<font color="#666666">:int</font>, y<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">largest of 2 integers.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(x<font color="#666666">:float</font>, y<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">largest of 2 floats.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(x<font color="#666666">:vec_i</font>, y<font color="#666666">:vec_i</font>) -> <font color="#666666">vec_i</font></tt></td><td class="a">largest components of 2 int vectors</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(x<font color="#666666">:vec_f</font>, y<font color="#666666">:vec_f</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">largest components of 2 float vectors</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(v<font color="#666666">:vec_i</font>) -> <font color="#666666">int</font></tt></td><td class="a">largest component of a int vector.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(v<font color="#666666">:vec_f</font>) -> <font color="#666666">float</font></tt></td><td class="a">largest component of a float vector.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(v<font color="#666666">:[int]</font>) -> <font color="#666666">int</font></tt></td><td class="a">largest component of a int vector, or INT_MIN if length 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>max</b>(v<font color="#666666">:[float]</font>) -> <font color="#666666">float</font></tt></td><td class="a">largest component of a float vector, or FLT_MIN if length 0.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>lerp</b>(x<font color="#666666">:float</font>, y<font color="#666666">:float</font>, f<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">linearly interpolates between x and y with factor f [0..1]</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>lerp</b>(a<font color="#666666">:vec_f</font>, b<font color="#666666">:vec_f</font>, f<font color="#666666">:float</font>) -> <font color="#666666">vec_f</font></tt></td><td class="a">linearly interpolates between a and b vectors with factor f [0..1]</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>cardinal_spline</b>(z<font color="#666666">:vec_f</font>, a<font color="#666666">:vec_f</font>, b<font color="#666666">:vec_f</font>, c<font color="#666666">:vec_f</font>, f<font color="#666666">:float</font>, tension<font color="#666666">:float</font>) -> <font color="#666666">xyz_f</font></tt></td><td class="a">computes the position between a and b with factor f [0..1], using z (before a) and c (after b) to form a cardinal spline (tension at 0.5 is a good default)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>line_intersect</b>(line1a<font color="#666666">:xy_f</font>, line1b<font color="#666666">:xy_f</font>, line2a<font color="#666666">:xy_f</font>, line2b<font color="#666666">:xy_f</font>) -> <font color="#666666">int</font>, <font color="#666666">xy_f</font></tt></td><td class="a">computes if there is an intersection point between 2 line segments, with the point as second return value</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>circles_within_range</b>(dist<font color="#666666">:float</font>, positions<font color="#666666">:[xy_f]</font>, radiuses<font color="#666666">:[float]</font>, positions2<font color="#666666">:[xy_f]</font>, radiuses2<font color="#666666">:[float]</font>, gridsize<font color="#666666">:xy_i</font>) -> <font color="#666666">[[int]]</font></tt></td><td class="a">Given a vector of 2D positions (and same size vectors of radiuses), returns a vector of vectors of indices (to the second set of positions and radiuses) of the circles that are within dist of eachothers radius. If the second set are [], the first set is used for both (and the self element is excluded). gridsize optionally specifies the size of the grid to use for accellerated lookup of nearby points. This is essential for the algorithm to be fast, too big or too small can cause slowdown. Omit it, and a heuristic will be chosen for you, which is currently sqrt(num_circles) * 2 along each dimension, e.g. 100 elements would use a 20x20 grid. Efficiency wise this algorithm is fastest if there is not too much variance in the radiuses of the second set and/or the second set has smaller radiuses than the first.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>wave_function_collapse</b>(tilemap<font color="#666666">:[string]</font>, size<font color="#666666">:xy_i</font>) -> <font color="#666666">[string]</font>, <font color="#666666">int</font></tt></td><td class="a">returns a tilemap of given size modelled after the possible shapes in the input tilemap. Tilemap should consist of chars in the 0..127 range. Second return value the number of failed neighbor matches, this should ideally be 0, but can be non-0 for larger maps. Simply call this function repeatedly until it is 0</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>resume</b>(coroutine<font color="#666666">:coroutine</font>, return_value<font color="#666666">:any</font> = nil) -> <font color="#666666">coroutine?</font></tt></td><td class="a">resumes execution of a coroutine, passing a value back or nil</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>return_value</b>(coroutine<font color="#666666">:coroutine</font>) -> <font color="#666666">any</font></tt></td><td class="a">gets the last return value of a coroutine</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>active</b>(coroutine<font color="#666666">:coroutine</font>) -> <font color="#666666">int</font></tt></td><td class="a">wether the given coroutine is still active</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>hash</b>(x<font color="#666666">:function</font>) -> <font color="#666666">int</font></tt></td><td class="a">hashes a function value into an int</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>hash</b>(x<font color="#666666"></font>) -> <font color="#666666">int</font></tt></td><td class="a">hashes any value into an int</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>program_name</b>() -> <font color="#666666">string</font></tt></td><td class="a">returns the name of the main program (e.g. "foo.lobster".</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>vm_compiled_mode</b>() -> <font color="#666666">int</font></tt></td><td class="a">returns if the VM is running in compiled mode (Lobster -> C++).</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>seconds_elapsed</b>() -> <font color="#666666">float</font></tt></td><td class="a">seconds since program start as a float, unlike gl_time() it is calculated every time it is called</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>assert</b>(condition<font color="#666666"></font>) -> <font color="#666666">any</font></tt></td><td class="a">halts the program with an assertion failure if passed false. returns its input</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>trace_bytecode</b>(mode<font color="#666666">:int</font>)</tt></td><td class="a">tracing shows each bytecode instruction as it is being executed, not very useful unless you are trying to isolate a compiler bug. Mode is off(0), on(1) or tail only (2)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_max_stack_size</b>(max<font color="#666666">:int</font>)</tt></td><td class="a">size in megabytes the stack can grow to before an overflow error occurs. defaults to 1</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>reference_count</b>(val<font color="#666666"></font>) -> <font color="#666666">int</font></tt></td><td class="a">get the reference count of any value. for compiler debugging, mostly</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>set_console</b>(on<font color="#666666">:bool</font>)</tt></td><td class="a">lets you turn on/off the console window (on Windows)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>command_line_arguments</b>() -> <font color="#666666">[string]</font></tt></td><td class="a"></td></tr>
<tr class="a" valign=top><td class="a"><tt><b>thread_information</b>() -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">returns the number of hardware threads, and the number of cores</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>is_worker_thread</b>() -> <font color="#666666">int</font></tt></td><td class="a">wether the current thread is a worker thread</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>start_worker_threads</b>(numthreads<font color="#666666">:int</font>)</tt></td><td class="a">launch worker threads</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>stop_worker_threads</b>()</tt></td><td class="a">only needs to be called if you want to stop the worker threads before the end of the program, or if you want to call start_worker_threads again. workers_alive will become false inside the workers, which should then exit.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>workers_alive</b>() -> <font color="#666666">int</font></tt></td><td class="a">wether workers should continue doing work. returns false after stop_worker_threads() has been called.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>thread_write</b>(struct<font color="#666666"></font>)</tt></td><td class="a">put this struct in the thread queue</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>thread_read</b>(type<font color="#666666">:typeid</font>) -> <font color="#666666">any?</font></tt></td><td class="a">get a struct from the thread queue. pass the typeof struct. blocks if no suchstructs available. returns struct, or nil if stop_worker_threads() was called</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>log_frame</b>()</tt></td><td class="a">call this function instead of gl_frame() or gl_log_frame() to simulate a frame based program from non-graphical code.</td></tr>
</table>
<h3>compiler</h3>
<table class="a" border=1 cellspacing=0 cellpadding=4>
<tr class="a" valign=top><td class="a"><tt><b>compile_run_code</b>(code<font color="#666666">:string</font>, args<font color="#666666">:[string]</font>) -> <font color="#666666">string</font>, <font color="#666666">string?</font></tt></td><td class="a">compiles and runs lobster source, sandboxed from the current program (in its own VM). the argument is a string of code. returns the return value of the program as a string, with an error string as second return value, or nil if none. using parse_data(), two program can communicate more complex data structures even if they don't have the same version of struct definitions.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>compile_run_file</b>(filename<font color="#666666">:string</font>, args<font color="#666666">:[string]</font>) -> <font color="#666666">string</font>, <font color="#666666">string?</font></tt></td><td class="a">same as compile_run_code(), only now you pass a filename.</td></tr>
</table>
<h3>file</h3>
<table class="a" border=1 cellspacing=0 cellpadding=4>
<tr class="a" valign=top><td class="a"><tt><b>scan_folder</b>(folder<font color="#666666">:string</font>, divisor<font color="#666666">:int</font>) -> <font color="#666666">[string]?</font>, <font color="#666666">[int]?</font></tt></td><td class="a">returns two vectors representing all elements in a folder, the first vector containing all names, the second vector containing sizes (or -1 if a directory). Specify 1 as divisor to get sizes in bytes, 1024 for kb etc. Values > 0x7FFFFFFF will be clamped in 32-bit builds. Returns nil if folder couldn't be scanned.</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_file</b>(file<font color="#666666">:string</font>, textmode<font color="#666666">:int</font> = 0) -> <font color="#666666">string?</font></tt></td><td class="a">returns the contents of a file as a string, or nil if the file can't be found. you may use either \ or / as path separators</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_file</b>(file<font color="#666666">:string</font>, contents<font color="#666666">:string</font>, textmode<font color="#666666">:int</font> = 0) -> <font color="#666666">int</font></tt></td><td class="a">creates a file with the contents of a string, returns false if writing wasn't possible</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>ensure_size</b>(string<font color="#666666">:string</font>, size<font color="#666666">:int</font>, char<font color="#666666">:int</font>, extra<font color="#666666">:int</font> = 0) -> <font color="#666666">string</font></tt></td><td class="a">ensures a string is at least size characters. if it is, just returns the existing string, otherwise returns a new string of that size (with optionally extra bytes added), with any new characters set to char. You can specify a negative size to mean relative to the end, i.e. new characters will be added at the start. </td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int64_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">writes a value as little endian to a string at location i. Uses ensure_size to make the string twice as long (with extra 0 bytes) if no space. Returns new string if resized, and the index of the location right after where the value was written. The _back version writes relative to the end (and writes before the index)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int32_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int16_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int8_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_float64_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:float</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_float32_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:float</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int64_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int32_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int16_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_int8_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_float64_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:float</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_float32_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, val<font color="#666666">:float</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">(see write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_substring</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, substr<font color="#666666">:string</font>, nullterm<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a">writes a substring into another string at i (see also write_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>write_substring_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>, substr<font color="#666666">:string</font>, nullterm<font color="#666666">:int</font>) -> <font color="#666666">string</font>, <font color="#666666">int</font></tt></td><td class="a"></td></tr>
<tr class="a" valign=top><td class="a"><tt><b>compare_substring</b>(string_a<font color="#666666">:string</font>, i_a<font color="#666666">:int</font>, string_b<font color="#666666">:string</font>, i_b<font color="#666666">:int</font>, len<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns if the two substrings are equal (0), or a < b (-1) or a > b (1).</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int64_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">reads a value as little endian from a string at location i. The value must be within bounds of the string. Returns the value, and the index of the location right after where the value was read. The _back version reads relative to the end (and reads before the index)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int32_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int16_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int8_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_float64_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">float</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_float32_le</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">float</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int64_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int32_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int16_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_int8_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">int</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_float64_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">float</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>read_float32_le_back</b>(string<font color="#666666">:string</font>, i<font color="#666666">:int</font>) -> <font color="#666666">float</font>, <font color="#666666">int</font></tt></td><td class="a">(see read_int64_le)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_int64</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>, def<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">reads a flatbuffers field from a string at table location tablei, field vtable offset vo, and default value def. The value must be within bounds of the string. Returns the value (or default if the field was not present)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_int32</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>, def<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">(see flatbuffers_field_int64)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_int16</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>, def<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">(see flatbuffers_field_int64)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_int8</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>, def<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">(see flatbuffers_field_int64)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_float64</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>, def<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">(see flatbuffers_field_int64)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_float32</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>, def<font color="#666666">:float</font>) -> <font color="#666666">float</font></tt></td><td class="a">(see flatbuffers_field_int64)</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_string</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>) -> <font color="#666666">string</font></tt></td><td class="a">reads a flatbuffer string field, returns "" if not present</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_vector_len</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">reads a flatbuffer vector field length, or 0 if not present</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_vector</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns a flatbuffer vector field element start, or 0 if not present</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_table</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns a flatbuffer table field start, or 0 if not present</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_field_struct</b>(string<font color="#666666">:string</font>, tablei<font color="#666666">:int</font>, vo<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns a flatbuffer struct field start, or 0 if not present</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_indirect</b>(string<font color="#666666">:string</font>, index<font color="#666666">:int</font>) -> <font color="#666666">int</font></tt></td><td class="a">returns a flatbuffer offset at index relative to itself</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_string</b>(string<font color="#666666">:string</font>, index<font color="#666666">:int</font>) -> <font color="#666666">string</font></tt></td><td class="a">returns a flatbuffer string whose offset is at given index</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_binary_to_json</b>(schemas<font color="#666666">:string</font>, binary<font color="#666666">:string</font>, includedirs<font color="#666666">:[string]</font>) -> <font color="#666666">string</font>, <font color="#666666">string?</font></tt></td><td class="a">returns a JSON string generated from the given binary and corresponding schema.if there was an error parsing the schema, the error will be in the second returnvalue, or nil for no error</td></tr>
<tr class="a" valign=top><td class="a"><tt><b>flatbuffers_json_to_binary</b>(schema<font color="#666666">:string</font>, json<font color="#666666">:string</font>, includedirs<font color="#666666">:[string]</font>) -> <font color="#666666">string</font>, <font color="#666666">string?</font></tt></td><td class="a">returns a binary flatbuffer generated from the given json and corresponding schema.if there was an error parsing the schema, the error will be in the second returnvalue, or nil for no error</td></tr>
</table>
<h3>parsedata</h3>
<table class="a" border=1 cellspacing=0 cellpadding=4>
<tr class="a" valign=top><td class="a"><tt><b>parse_data</b>(typeid<font color="#666666">:typeid</font>, stringdata<font color="#666666">:string</font>) -> <font color="#666666">any?</font>, <font color="#666666">string?</font></tt></td><td class="a">parses a string containing a data structure in lobster syntax (what you get if you convert an arbitrary data structure to a string) back into a data structure. supports int/float/string/vector and classes. classes will be forced to be compatible with their  current definitions, i.e. too many elements will be truncated, missing elements will be set to 0/nil if possible. useful for simple file formats. returns the value and an error string as second return value (or nil if no error)</td></tr>
</table>
</td></tr></table></center></body>
</html>