【发布时间】:2011-11-01 14:58:48
【问题描述】:
不确定是否有人遇到过这种问题。这是我的代码
在 main.lua 中:
local highScore = require("highScore")
local username = "myName"
local finishedTime = 12345
highScore:InsertHighScore(userName, finishedTime)
在 highScore.lua 中
function InsertHighScore(name,time)
print(name)
print(time)
-- other code
end
它看起来很简单,应该没有错,但在我的控制台中显示:
table: 0x19e6340
myName
经过一天的测试,我发现在我传递的2个参数之前,它实际上传递了另一个表给我,所以在highScore.lua上进行这些更改:
function InsertHighScore(table,name,time)
print(table)
print(name)
print(time)
-- other code
end
所以现在我的“其他代码”可以很好地工作,但为什么它在我的参数之前传递了一个表格?
【问题讨论】:
标签: function methods parameters lua