【发布时间】:2013-05-10 19:10:54
【问题描述】:
这是我刚刚在 SCIte 中编写的一些 Lua 代码,我不知道它到底有什么问题,所以有人可以向我解释我做错了什么以及如何解决它吗?
t = setmetatable({},{
__newindex = function(t, key)
if key == false then
return( "False cannot exist in table")
key = nil
end
if key == __string then
table.concat[table, key]
else
table[key] = nil
end
if key == nil then
return "Tables in this file cannot contain false values."
end
}
)
function Error()
_,cError = pcall(__index)
end
function Call1()
error("error in metatable function, '__index'", 1)
end
function Call2()
Call1()
end
Error()
Call2()
【问题讨论】:
-
你怎么知道它是“错误的”?它不做你想做的事吗?您是否只是在尝试编译时收到错误消息?
-
@DavidGelhar 是的,它确实会导致错误消息。
标签: lua syntax-error scite