在我使用Gideros Studio开发的游戏中,我有一个具有多个参数的函数。我想先调用其中一个参数,然后再调用另一个参数。这种做法可行吗?
以下是我的函数:
local function wiggleroom(a,b,c)
for i = 1,50 do
if a > b then
a = a - 1
elseif a < b then
a = a + 1
elseif a == b then
c = "correct"
end
return c
end
end
我希望将a
与b
进行比较,但稍后在b
和c
上调用该函数。例如:
variable = (wiggleroom(variable, b, c) --if variable was defined earlier
variable2 = (wiggleroom(a, variable2, c)
variable3 = (wiggleroom(a, b, variable3)
我还希望能够将此功能用于多个对象(每个参数调用两次)。