1
我需要存储表中的文件的所有行,但我需要开始阅读它在一个特定的点。这里的文件示例如下:开始从一个特定的行读取文件
class Foo as
attribute max : number
def static show as
count : number
begin
io.print(count)
return count
end
attribute min : number
end
program
var x : number
var foo : Foo
x = 20
foo = new Foo
foo.show(x)
end
我需要在程序中开始读取,并将下面的程序存储在表格中。
我已经这样做了:
for line in io.lines(file) do
table.insert(program.body, line);
end;
但(当然)这整个文件循环。我需要从程序循环到结束。
您能否向我解释“内部”变量中发生了什么?谢谢。 :) –
'inside'在以“program”开头的行之前是'nil',并且在该行之后不是'nil'。 [“和”在Lua中](https://www.lua.org/pil/3.3.html) –