【发布时间】:2015-08-07 19:48:47
【问题描述】:
我刚刚开始为Foldit 编写脚本。这是我第一次体验Lua,所以我的状态是“有见识的菜鸟”。在我的第一个脚本中,我想打印出contactmap 数据。我已经从http://foldit.wikia.com/wiki/Foldit_Lua_Functions 复制并粘贴了函数。我得到的错误是:
attempt to index global 'structure' (a nil value)
这是我的代码:
segmentCount = structure.GetCount()
print ("Segment count: " .. segmentCount)
for source = 1, segmentCount do
for target = source + 1, segmentCount do
inContact = contactmap.IsContact(source, target)
heat = contactmap.GetHeat(source, target)
print("Segments "..source..", ".. target..": heat = "..heat)
end
end
提前感谢您的任何启发。
编辑
问题是我最初加载了 V1 配方,而 foldit 继续将其视为 V1 语法。解决方案是创建一个新的(ScriptV2)配方,并加载完全相同的代码。
【问题讨论】: