NWNX:EE  8193.36.12
inc_array.nss
Go to the documentation of this file.
1 
6 const int INVALID_INDEX = -1;
7 const int TYPE_FLOAT = 0;
8 const int TYPE_INTEGER = 1;
9 const int TYPE_OBJECT = 2;
10 const int TYPE_STRING = 3;
11 
20 string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID);
21 float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID);
22 int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID);
23 object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID);
25 
26 
28 void Array_Clear(string tag, object obj=OBJECT_INVALID);
29 
38 int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID);
39 int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID);
40 int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID);
41 int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID);
43 
45 void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID);
46 
48 void Array_Erase(string tag, int index, object obj=OBJECT_INVALID);
49 
58 int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID);
59 int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID);
60 int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID);
61 int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID);
63 
72 void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID);
73 void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID);
74 void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID);
75 void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID);
77 
86 void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID);
87 void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID);
88 void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID);
89 void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID);
91 
93 void Array_Resize(string tag, int size, object obj=OBJECT_INVALID);
94 
96 void Array_Shuffle(string tag, object obj=OBJECT_INVALID);
97 
99 int Array_Size(string tag, object obj=OBJECT_INVALID);
100 
102 void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID);
103 
105 void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID);
106 
115 void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID);
116 void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID);
117 void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID);
118 void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID);
120 
122 
123 //
124 // Local Utility Functions.
125 //
126 string GetTableName(string tag, object obj=OBJECT_INVALID, int bare=FALSE) {
127  if (obj == OBJECT_INVALID)
128  obj = GetModule();
129 
130  string sName = "array_" + ObjectToString(obj) + "_" + tag;
131  // Remove invalid characters from the tag rather than failing.
132  string sCleansed = RegExpReplace("[^A-Za-z0-9_\$@#]", sName, "");
133  // But provide some feedback.
134  if (GetStringLength(sName) != GetStringLength(sCleansed) || GetStringLength(sCleansed) == 0) {
135  WriteTimestampedLogEntry("WARNING: Invalid table name detected for array with tag <" + tag + ">. Only characters (a-zA-Z0-9), _, @, $ and # are allowed. Using <"+sCleansed+"> instead.");
136 
137  }
138 
139  // BARE returns just the table name with no wrapping.
140  if (bare == TRUE) {
141  return sCleansed;
142  }
143 
144  // Table name wraped in quotes to avoid token expansion.
145  return "\""+sCleansed+"\"";
146 }
147 
148 string GetTableCreateString(string tag, object obj=OBJECT_INVALID) {
149  // for simplicity sake, everything is turned into a string. Possible enhancement
150  // to create specific tables for int/float/whatever.
151  return "CREATE TABLE IF NOT EXISTS " + GetTableName(tag, obj) + " ( ind INTEGER, value TEXT )";
152 }
153 
154 int TableExists(string tag, object obj=OBJECT_INVALID) {
155  string stmt = "SELECT name FROM sqlite_master WHERE type = 'table' AND name = @tablename;";
156  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
157  SqlBindString(sqlQuery, "@tablename", GetTableName(tag, obj, TRUE));
158  return SqlStep(sqlQuery);
159 }
160 
161 void ExecuteStatement(string statement, object obj=OBJECT_INVALID) {
162  if (obj == OBJECT_INVALID)
163  obj = GetModule();
164  // There's no direct "execute this.." everything has to be prepared then executed.
165  //WriteTimestampedLogEntry("SQL: " + statement);
166  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), statement);
167  SqlStep(sqlQuery);
168 }
169 
170 void CreateArrayTable(string tag, object obj=OBJECT_INVALID) {
171  string createStatement = GetTableCreateString(tag, obj);
172  ExecuteStatement(createStatement, obj);
173 }
174 
175 // Get the table row count. Returns -1 on error (0 is a valid number of rows in a table)
176 int GetRowCount(string tag, object obj=OBJECT_INVALID) {
177  if (obj == OBJECT_INVALID)
178  obj = GetModule();
179  CreateArrayTable(tag, obj);
180  string stmt = "SELECT COUNT(1) FROM " + GetTableName(tag, obj);
181  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
182  if ( SqlStep(sqlQuery) ) {
183  return SqlGetInt(sqlQuery, 0);
184  }
185  return -1;
186 }
187 
188 
190 // return the value contained in location "index"
191 string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID)
192 {
193  // Just "create if not exists" to ensure it exists for the insert.
194  CreateArrayTable(tag, obj);
195 
196  string stmt = "SELECT value FROM " + GetTableName(tag, obj) + " WHERE ind = @ind";
197  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
198  SqlBindInt(sqlQuery, "@ind", index);
199  if ( SqlStep(sqlQuery) ) {
200  return SqlGetString(sqlQuery, 0);
201  }
202  return "";
203 }
204 
205 float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID)
206 {
207  string st = Array_At_Str(tag, index, obj);
208  if (st == "") {
209  return 0.0;
210  }
211  return StringToFloat(st);
212 }
213 
214 int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID)
215 {
216  string st = Array_At_Str(tag, index, obj);
217  if (st == "") {
218  return 0;
219  }
220  return StringToInt(st);
221 }
222 
223 object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID)
224 {
225  string st = Array_At_Str(tag, index, obj);
226  if (st == "") {
227  return OBJECT_INVALID;
228  }
229  return StringToObject(st);
230 }
231 
232 void Array_Clear(string tag, object obj=OBJECT_INVALID)
233 {
234  ExecuteStatement("delete from "+GetTableName(tag, obj), obj);
235 }
236 
238 // Return true/value (1/0) if the array contains the value "element"
239 int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID)
240 {
241  CreateArrayTable(tag, obj);
242  string stmt = "SELECT COUNT(1) FROM "+GetTableName(tag, obj)+" WHERE value = @element";
243 
244  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
245  SqlBindString(sqlQuery, "@element", element);
246 
247  int pos = -1;
248  if ( SqlStep(sqlQuery) ) {
249  pos = SqlGetInt(sqlQuery, 0);
250  if (pos > 0) {
251  return TRUE;
252  }
253  }
254  return FALSE;
255 }
256 
257 int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID)
258 {
259  return Array_Contains_Str(tag, FloatToString(element), obj);
260 }
261 
262 int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID)
263 {
264  return Array_Contains_Str(tag, IntToString(element), obj);
265 }
266 
267 int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID)
268 {
269  return Array_Contains_Str(tag, ObjectToString(element), obj);
270 }
271 
272 
274 void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID)
275 {
276  CreateArrayTable(otherTag, obj);
277  ExecuteStatement("INSERT INTO "+GetTableName(otherTag, obj)+" SELECT * FROM "+GetTableName(tag, obj), obj);
278 }
279 
281 void Array_Erase(string tag, int index, object obj=OBJECT_INVALID)
282 {
283  int rows = GetRowCount(tag, obj);
284  // Silently fail if "index" is outside the range of valid indicies.
285  if (index >= 0 && index < rows) {
286  string stmt = "DELETE FROM "+GetTableName(tag, obj)+" WHERE ind = @ind";
287  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
288  SqlBindInt(sqlQuery, "@ind", index);
289  SqlStep(sqlQuery);
290 
291  stmt = "UPDATE "+GetTableName(tag, obj)+" SET ind = ind - 1 WHERE ind > @ind";
292  sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
293  SqlBindInt(sqlQuery, "@ind", index);
294  SqlStep(sqlQuery);
295  }
296 }
297 
299 // return the index in the array containing "element"
300 // if not found, return INVALID_INDEX
301 int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID)
302 {
303  string stmt;
304  sqlquery sqlQuery;
305 
306  // Just create it before trying to select in case it doesn't exist yet.
307  CreateArrayTable(tag, obj);
308 
309  stmt = "SELECT IFNULL(MIN(ind),@invalid_index) FROM "+GetTableName(tag, obj)+" WHERE value = @element";
310  sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
311 
312  SqlBindInt(sqlQuery, "@invalid_index", INVALID_INDEX);
313  SqlBindString(sqlQuery, "@element", element);
314  if ( SqlStep(sqlQuery) ) {
315  return SqlGetInt(sqlQuery, 0);
316  }
317  return INVALID_INDEX;
318 }
319 
320 int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID)
321 {
322  return Array_Find_Str(tag, FloatToString(element), obj);
323 }
324 
325 int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID)
326 {
327  return Array_Find_Str(tag, IntToString(element), obj);
328 }
329 
330 int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID)
331 {
332  return Array_Find_Str(tag, ObjectToString(element), obj);
333 }
334 
336 // Insert a new element into position 'index'. If index is beyond the number of rows in the array,
337 // this will quietly fail. This could be changed if you wanted to support sparse
338 // arrays.
339 void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID)
340 {
341  int rows = GetRowCount(tag, obj);
342  // Index numbers are off by one, much like C arrays, so for "rows=10" - values are 0-9.
343  // It's not unreasonable to fail if you try to insert ind=10 into an array who's indexes
344  // only go to 9, but I guess it doesn't hurt as long as we're not allowing gaps in
345  // index numbers.
346  if (index >= 0 && index <= rows) {
347  // index is passed as an integer, so immune (as far as I know) to SQL injection for a one shot query.
348  ExecuteStatement("UPDATE "+GetTableName(tag, obj)+" SET ind = ind + 1 WHERE ind >= "+IntToString(index), obj);
349  // Element, however, is not.
350  string stmt = "INSERT INTO "+GetTableName(tag, obj)+" VALUES ( @ind, @element )";
351  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
352  SqlBindInt(sqlQuery, "@ind", index);
353  SqlBindString(sqlQuery, "@element", element);
354  SqlStep(sqlQuery);
355  }
356 }
357 
358 void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID)
359 {
360  Array_Insert_Str(tag, index, FloatToString(element), obj);
361 }
362 
363 void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID)
364 {
365  Array_Insert_Str(tag, index, IntToString(element), obj);
366 }
367 
368 void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID)
369 {
370  Array_Insert_Str(tag, index, ObjectToString(element), obj);
371 }
372 
374 // Insert a new element at the end of the array.
375 void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID)
376 {
377  // Create it before trhing to INSERT into it. If it already exists, this is a no-op.
378  CreateArrayTable(tag, obj);
379 
380  // If rowCount = 10, indexes are from 0 to 9, so this becomes the 11th entry at index 10.
381  int rowCount = GetRowCount(tag, obj);
382 
383  string stmt = "INSERT INTO "+GetTableName(tag, obj)+" VALUES ( @ind, @element )";
384  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
385  SqlBindInt(sqlQuery, "@ind", rowCount);
386  SqlBindString(sqlQuery, "@element", element);
387  SqlStep(sqlQuery);
388 }
389 
390 void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID)
391 {
392  Array_PushBack_Str(tag, FloatToString(element), obj);
393 }
394 
395 void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID)
396 {
397  Array_PushBack_Str(tag, IntToString(element), obj);
398 }
399 
400 void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID)
401 {
402  Array_PushBack_Str(tag, ObjectToString(element), obj);
403 }
404 
406 // Cuts the array off at size 'size'. Elements beyond size are removed.
407 void Array_Resize(string tag, int size, object obj=OBJECT_INVALID)
408 {
409  // Int immune to sql injection so easier to one-shot it.
410  ExecuteStatement("DELETE FROM "+GetTableName(tag, obj)+" WHERE ind >= " + IntToString(size), obj);
411 }
412 
414 void Array_Shuffle(string tag, object obj=OBJECT_INVALID)
415 {
416  string table = GetTableName(tag, obj, TRUE);
417  ExecuteStatement("CREATE TABLE " +table+ "_temp AS SELECT ROW_NUMBER() OVER(ORDER BY RANDOM())-1, value FROM " +table, obj);
418  ExecuteStatement("DELETE FROM " +table , obj);
419  ExecuteStatement("INSERT INTO " +table+ " SELECT * FROM " +table+ "_temp", obj);
420  ExecuteStatement("DROP TABLE " +table+ "_TEMP", obj);
421 }
422 
424 int Array_Size(string tag, object obj=OBJECT_INVALID)
425 {
426  return GetRowCount(tag, obj);
427 }
428 
430 // Sort the array by value according to 'direction' (ASC or DESC).
431 // Supplying a type allows for correct numerical sorting of integers or floats.
432 void Array_Sort(string tag, string dir="ASC", int type=TYPE_STRING, object obj=OBJECT_INVALID)
433 {
434  string table = GetTableName(tag, obj, TRUE);
435  string direction = GetStringUpperCase(dir);
436 
437  if ( ! (direction == "ASC" || direction == "DESC") ) {
438  WriteTimestampedLogEntry("WARNING: Invalid sort direction <" + direction + "> supplied. Defaulting to ASC.");
439  direction = "ASC";
440  }
441 
442  // default orderBy for strings.
443  string orderBy = "ORDER BY value " + direction;
444  switch(type) {
445  case TYPE_INTEGER:
446  orderBy = "ORDER BY CAST(value AS INTEGER)" + direction;
447  break;
448  case TYPE_FLOAT:
449  orderBy = "ORDER BY CAST(value AS DECIMAL)" + direction;
450  break;
451  }
452  ExecuteStatement("CREATE TABLE " +table+ "_temp AS SELECT ROW_NUMBER() OVER(" + orderBy + ")-1, value FROM " +table, obj);
453  ExecuteStatement("DELETE FROM " +table, obj);
454  ExecuteStatement("INSERT INTO " +table+ " SELECT * FROM " +table+ "_temp", obj);
455  ExecuteStatement("DROP TABLE " +table+ "_temp", obj);
456 }
457 
458 void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID)
459 {
460  Array_Sort(tag, "ASC", type, obj);
461 }
462 
463 void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID)
464 {
465  Array_Sort(tag, "DESC", type, obj);
466 }
467 
469 // Set the value of array index 'index' to a 'element'
470 // This will quietly eat values if index > array size
471 void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID)
472 {
473  int rows = GetRowCount(tag, obj);
474  if (index >= 0 && index <= rows) {
475  string stmt = "UPDATE "+GetTableName(tag, obj)+" SET value = @element WHERE ind = @ind";
476  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
477  SqlBindInt(sqlQuery, "@ind", index);
478  SqlBindString(sqlQuery, "@element", element);
479  SqlStep(sqlQuery);
480  }
481 }
482 
483 void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID)
484 {
485  Array_Set_Str(tag, index, FloatToString(element), obj);
486 }
487 
488 void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID)
489 {
490  Array_Set_Str(tag, index, IntToString(element), obj);
491 }
492 
493 void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID)
494 {
495  Array_Set_Str(tag, index, ObjectToString(element), obj);
496 }
497 
498 void Array_Debug_Dump(string tag, string title = "xxx", object obj=OBJECT_INVALID) {
499  if (title != "xxx") {
500  WriteTimestampedLogEntry("== " + title + " ======================================");
501  }
502  WriteTimestampedLogEntry("Table name = " + GetTableName(tag, obj));
503  string stmt = "SELECT ind, value FROM " + GetTableName(tag, obj);
504  sqlquery sqlQuery = SqlPrepareQueryObject(GetModule(), stmt);
505  int ind = -1;
506  string value = "";
507  while ( SqlStep(sqlQuery) ) {
508  ind = SqlGetInt(sqlQuery, 0);
509  value = SqlGetString(sqlQuery, 1);
510  WriteTimestampedLogEntry(tag + "[" + IntToString(ind) + "] = " + value);
511  }
512 }
Array_SortDescending
void Array_SortDescending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID)
Sorts the collection based on descending order.
Definition: inc_array.nss:463
Array_At_Flt
float Array_At_Flt(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:205
Array_Resize
void Array_Resize(string tag, int size, object obj=OBJECT_INVALID)
Resizes the array. If the array is shrinking, it chops off elements at the ned.
Definition: inc_array.nss:407
Array_Debug_Dump
void Array_Debug_Dump(string tag, string title="xxx", object obj=OBJECT_INVALID)
Definition: inc_array.nss:498
Array_Set_Flt
void Array_Set_Flt(string tag, int index, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:483
Array_Set_Obj
void Array_Set_Obj(string tag, int index, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:493
Array_Copy
void Array_Copy(string tag, string otherTag, object obj=OBJECT_INVALID)
Copies the array of name otherTag over the array of name tag.
Definition: inc_array.nss:274
Array_Contains_Flt
int Array_Contains_Flt(string tag, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:257
Array_Shuffle
void Array_Shuffle(string tag, object obj=OBJECT_INVALID)
Reorders the array such each possible permutation of elements has equal probability of appearance.
Definition: inc_array.nss:414
ExecuteStatement
void ExecuteStatement(string statement, object obj=OBJECT_INVALID)
Definition: inc_array.nss:161
Array_Insert_Str
void Array_Insert_Str(string tag, int index, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:339
Array_Set_Str
void Array_Set_Str(string tag, int index, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:471
Array_At_Obj
object Array_At_Obj(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:223
Array_Insert_Flt
void Array_Insert_Flt(string tag, int index, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:358
GetRowCount
int GetRowCount(string tag, object obj=OBJECT_INVALID)
Definition: inc_array.nss:176
Array_Find_Str
int Array_Find_Str(string tag, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:301
TableExists
int TableExists(string tag, object obj=OBJECT_INVALID)
Definition: inc_array.nss:154
GetTableName
string GetTableName(string tag, object obj=OBJECT_INVALID, int bare=FALSE)
Definition: inc_array.nss:126
Array_Insert_Obj
void Array_Insert_Obj(string tag, int index, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:368
Array_At_Str
string Array_At_Str(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:191
Array_Clear
void Array_Clear(string tag, object obj=OBJECT_INVALID)
Clears the entire array, such that size==0.
Definition: inc_array.nss:232
Array_Insert_Int
void Array_Insert_Int(string tag, int index, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:363
Array_PushBack_Flt
void Array_PushBack_Flt(string tag, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:390
Array_PushBack_Str
void Array_PushBack_Str(string tag, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:375
Array_Set_Int
void Array_Set_Int(string tag, int index, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:488
Array_PushBack_Obj
void Array_PushBack_Obj(string tag, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:400
TYPE_STRING
const int TYPE_STRING
Definition: inc_array.nss:10
TYPE_INTEGER
const int TYPE_INTEGER
Definition: inc_array.nss:8
INVALID_INDEX
const int INVALID_INDEX
Definition: inc_array.nss:6
Array_Contains_Obj
int Array_Contains_Obj(string tag, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:267
GetTableCreateString
string GetTableCreateString(string tag, object obj=OBJECT_INVALID)
Definition: inc_array.nss:148
Array_Erase
void Array_Erase(string tag, int index, object obj=OBJECT_INVALID)
Erases the element at index, and shuffles any elements from index size-1 to index + 1 left.
Definition: inc_array.nss:281
Array_Contains_Int
int Array_Contains_Int(string tag, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:262
TYPE_OBJECT
const int TYPE_OBJECT
Definition: inc_array.nss:9
Array_At_Int
int Array_At_Int(string tag, int index, object obj=OBJECT_INVALID)
Definition: inc_array.nss:214
CreateArrayTable
void CreateArrayTable(string tag, object obj=OBJECT_INVALID)
Definition: inc_array.nss:170
Array_Sort
void Array_Sort(string tag, string dir="ASC", int type=TYPE_STRING, object obj=OBJECT_INVALID)
Definition: inc_array.nss:432
Array_Find_Obj
int Array_Find_Obj(string tag, object element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:330
Array_Find_Flt
int Array_Find_Flt(string tag, float element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:320
TYPE_FLOAT
const int TYPE_FLOAT
Definition: inc_array.nss:7
Array_Size
int Array_Size(string tag, object obj=OBJECT_INVALID)
Returns the size of the array.
Definition: inc_array.nss:424
Array_Find_Int
int Array_Find_Int(string tag, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:325
Array_SortAscending
void Array_SortAscending(string tag, int type=TYPE_STRING, object obj=OBJECT_INVALID)
Sorts the collection based on descending order.
Definition: inc_array.nss:458
Array_Contains_Str
int Array_Contains_Str(string tag, string element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:239
Array_PushBack_Int
void Array_PushBack_Int(string tag, int element, object obj=OBJECT_INVALID)
Definition: inc_array.nss:395