⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 array.2d

📁 C实现的MUD,对大家基本入门网络游戏很有帮助!
💻 2D
字号:
2D arrays can be done in LPC, quite simply.  Just treat them as an array of 
arrays.  For example,
 
   a = allocate(10);
   a[0] = allocate(10);
   a[1] = allocate(10);
   ...etc...
 
Then you can reference array 0, element 0, via
 
   a[0][0]
 
You can't declare an array of more than 1 dimension (using the type * 
notation, if you have type checking on), but you can have an array of more 
than one dimension.  If you have type checking on, you will probably have
to declare them as type mixed.
 
This also works:
 
   mixed a;
   a = ({ ({ 1, 2, 3 }), ({ 1, 2, 3 }) });
 
In the above example, a[0] would be ({ 1, 2, 3 }), and a[0][2] would be 3.
 
Or this:
 
  mixed a;  
  a = ({ 0, 0, 0, 0 });  /* just to get the array to size 4 */
  a[0] = ({ 1, 2, 3 });
  a[1] = ({ 1, 2, 3 });
  ...etc...
 
John Price a.k.a. Raistlin

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -