这对于基本功能已经很不错了,但是在实际中,您可能需要返回更复杂的类型,比如对象和数组。
This is fine for basic functions, but in reality, you're likely to need to return complex types such as objects and arrays.
从这里开始,我们可以继续根据需要一次滚动多个骰子,返回结果数组;也可以一次性滚动多个不同类型的骰子。
From here, we can go on to rolling multiple die at once, returning an array of results, or rolling multiple die of different kinds all at once, depending on our needs.
现在有了基本地形类型,您可以想象得到接下来需要做什么:为每一行创建一个地图图像块数组。
Now that we have basic terrain types, you can imagine what comes next: we create an array of map tiles for each row.
现在您需要定义一个article类型的数组。
注意:数组需要在lsxsd . lss文件内定义的ARRAY_HOLDER数据类型之一中返回(本系列的上一篇文章更详细地讨论了这种情况)。
NOTE: the array needs to be returned within one of the ARRAY_HOLDER data types defined in the lsxsd.lss file (the previous article in this series discusses this situation in more detail).
这种增强不需要太多的描述,但应用户要求,对“可pickle”类型集合增加了Numeric数组。
The enhancement doesn't require too much description, but in response to user requests, there is the addition of Numeric arrays to the set of "picklable" types.
在需要输出一个类型的多个实例的情况下 —— 在这个示例中,有两只猫和一只狗 —— 需要以匿名散列的匿名数组的形式收集散列。
Where there is more than one instance of the type to output -- in this case, where you have two cats but one dog -- you need to collect the hashes as an anonymous array of anonymous hashes.
数组被类型化,所以您需要很清楚地知道数组中每个项目的变量类型是什么。
Arrays are typed, and so you know exactly what variable type is going to be needed for each item in the array.
正如我们接下来看到的代码那样,花括号中的数组值就需要对数组进行是否创建和类型的推断。
As you can see below, the presence of the array contents in brackets is enough to both infer that an array is being created and what type that would be.
其他数据类型(如函数指针、数组和结构)需要一些附加特性以确保进行正确的数据封送处理。
Other data types, such as function Pointers, arrays, and structures, require additional attributes to ensure proper data marshaling.
有时候你需要拼接几个一维数组,而不是要组建二维数组,这种情况下,你需要点击函数,在菜单中选择连接输入端的类型。
Sometimes you'll want to concatenate several 1D arrays together, instead of building a 2D array. In this case, you'll need to pop up on the Build Array function, and choose Concatenate Inputs.
有时候你需要拼接几个一维数组,而不是要组建二维数组,这种情况下,你需要点击函数,在菜单中选择连接输入端的类型。
Sometimes you'll want to concatenate several 1D arrays together, instead of building a 2D array. In this case, you'll need to pop up on the Build Array function, and choose Concatenate Inputs.
应用推荐