1

我最近开始对 Lua 编程感兴趣,我使用了一个名为 Computercraft 的 Minecraft 插件,它涉及基于控制台的 GUI 来使用 Lua 控制计算机和其他东西。但是,我似乎随机收到一个错误,其中代码需要称为“eof”的东西。我搜索了多本手册和操作方法,但没有人提到这个特定的错误。事实上,我很难找到带有错误列表的任何内容。我对编程很陌生,但有基本的 Python 经验。谁能解释一下“eof”是什么?

4

3 回答 3

2

eofdothen。_

通常eof意味着你有太多(或不够)的end陈述。粘贴代码可能吗?

于 2013-02-27T05:25:21.717 回答
0

Suppose I create a file with one too many end statements:

> edit test.lua

for i = 1, 10 do
  print(i)
end
end

When I run it, and lua encounters that extra end statement on the last line where there is no code block still open, you'll get an error like:

> test.lua

bios: 337: [string "test.lua"]: 4: '<eof>' expected

(from a quick test in CCDesk pr7.1.1)

Problems with the basic structure of the blocks of lua code show up with bios on the left rather than your file name; the part of bios that loads lua files will usually tell you where it was at in the file when couldn't make sense of the code anymore (like line 4: here). Sometimes it might be a bit of a puzzle to work your way from the scene of the accident back to where things got off track. =)

于 2013-10-16T06:43:00.817 回答
0

使用 ESPlorer,“上传”脚本和“发送”脚本是有区别的。使用“上传”。

这与报告的问题不同,但搜索让我来到这里......

于 2017-01-29T23:07:54.700 回答