在函数中,有没有办法获取用户显式使用的所有参数的列表?

问题描述 投票:0回答:1

这是我一直在 PowerShell 中做的事情。对象

$PsBoundParameters
包含用户显式调用的所有参数的数组,不包括具有默认值的参数。

在 AHK 中,如果我有一个具有以下参数的函数,并且我要以

MyCar("Red",, 4)
的形式调用它,那么在函数内部我如何获取所使用的参数?

MyCar(Color, TyreCount, SeatCount, Plate := 1975){
}

谢谢!

autohotkey
1个回答
0
投票
Color := "Red"
SeatCount := 4

MsgBox, % MyCar(Color, TyreCount, SeatCount)

MyCar(Color, TyreCount, SeatCount, Plate := 1975){
    return "Color = " color  "`nTyreCount = " TyreCount "`nSeatCount = " SeatCount "`nPlate = " Plate 
}

如果我理解你的问题是正确的。

© www.soinside.com 2019 - 2024. All rights reserved.