小编dro*_*els的帖子

在 Lua 中读取一行(而且只是一行)。如何?

假设我有这个 .txt 文件:

this is line one
hello world
line three
Run Code Online (Sandbox Code Playgroud)

在Lua中,我想仅使用第二行的内容创建一个字符串,就像我想从该文件中获取特定行并将其放入字符串中 io.open('file.txt', 'r') -- 读取仅第二行并将其放入字符串中,例如:local line2 =“hello world”

lua

2
推荐指数
1
解决办法
3228
查看次数

标签 统计

lua ×1