‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
table_shared.gsc
Go to the documentation of this file.
1 
2 #namespace table;
3 
14 function ‪load( str_filename, str_table_start, b_convert_numbers = true )
15 {
16  a_table = [];
17 
18  n_header_row = TableLookupRowNum( str_filename, 0, str_table_start );
19 
20  Assert( n_header_row > -1, "Could not find start of table." );
21 
22  a_headers = TableLookupRow( str_filename, n_header_row );
23 
24  n_row = n_header_row + 1;
25 
26  do
27  {
28  a_row = TableLookupRow( str_filename, n_row );
29 
30  if ( isdefined( a_row ) && a_row.size > 0 )
31  {
32  index = StrStrip( a_row[ 0 ] );
33 
34  if ( index != "" )
35  {
36  if ( index == "table_end" )
37  {
38  break;
39  }
40 
41  if ( b_convert_numbers )
42  {
43  index = ‪str_to_num( index );
44  }
45 
46  a_table[ index ] = [];
47 
48  for ( val = 1; val < a_row.size; val++ )
49  {
50  if ( StrStrip( a_headers[ val ] ) != "" && strStrip( a_row[ val ] ) != "" )
51  {
52  value = a_row[ val ];
53 
54  if ( b_convert_numbers )
55  {
56  value = ‪str_to_num( value );
57  }
58 
59  a_table[ index ][ a_headers[ val ] ] = value;
60  }
61  }
62  }
63  }
64 
65  n_row++;
66  }
67  while ( isdefined( a_row ) && a_row.size > 0 );
68 
69  return a_table;
70 }
71 
72 function ‪str_to_num( value )
73 {
74  if ( StrIsInt( value ) )
75  {
76  value = Int( value );
77  }
78  else if ( StrIsFloat( value ) )
79  {
80  value = Float( value );
81  }
82 
83  return value;
84 }
‪str_to_num
‪function str_to_num(value)
Definition: table_shared.gsc:72
‪load
‪function load(str_filename, str_table_start, b_convert_numbers=true)
Definition: table_shared.gsc:14