Appearance
配方
获取配方
GetRecipe
lua
recipe = GetRecipe(index)
获取一组配方
提示
需提前在配方管理页中新建或导入配方并设为默认
参数
参数 | 类型 | 描述 |
---|---|---|
index | Integer 整数 | 配方索引 |
返回值
返回值 | 类型 | 描述 |
---|---|---|
recipe | Table 表 | 配方,失败返回nil |
切换配方
GetRecipe
lua
SwitchRecipe(recipe)
切换到指定的配方
参数
参数 | 类型 | 描述 |
---|---|---|
recipe | String 字符串 | 配方名 |
使用配方
假设有如下的配方文件:
json
{
"recipe": [
{
"pin": 1,
"PinHeight": 7.95,
"PinHeightMax": 0.5,
"PinHeightMin": 0.5,
"PinHeightSupply": 0,
"PinPositionX": 26.8,
"PinPositionXMax": 0.5,
"PinPositionXMin": 0.5,
"PinPositionXSupply": 0,
"PinPositionY": 8.8,
"PinPositionYMax": 0.5,
"PinPositionYMin": 0.5,
"PinPositionYSupply": 0,
"PinSideX": 3.5,
"PinSideXMax": 0.3,
"PinSideXMin": 0.3,
"PinSideY": 0,
"PinSideYMax": 0.3,
"PinSideYMin": 0.3,
"PinSideHight": 0,
"PinSideHightMax": 0.3,
"PinSideHightMin": 0.3
},
{
"pin": 2,
"PinHeight": 7.95,
"PinHeightMax": 0.5,
"PinHeightMin": 0.5,
"PinHeightSupply": 0,
"PinPositionX": 23.4,
"PinPositionXMax": 0.5,
"PinPositionXMin": 0.5,
"PinPositionXSupply": 0,
"PinPositionY": 8.8,
"PinPositionYMax": 0.5,
"PinPositionYMin": 0.5,
"PinPositionYSupply": 0,
"PinSideX": 3.5,
"PinSideXMax": 0.3,
"PinSideXMin": 0.3,
"PinSideY": 0,
"PinSideYMax": 0.3,
"PinSideYMin": 0.3,
"PinSideHight": 0,
"PinSideHightMax": 0.3,
"PinSideHightMin": 0.3
},
]
}
使用配方管理器加载配方,获取第一组参数中的PinHeight
参数的方法如下:
lua
recipe = GetRecipe(0)
PinHeight0 = recipe.PinHeight
println(PinHeight0)
输出
7.95