Lua读取文件和写入文件
2016-05-24 16:39
393 查看
function FileSaveLoad()
local file = io.open("test.txt", "r");
assert(file);
local data = file:read("*a"); --读取所有内容
file:close();
file = io.open("test.lua", "w");
assert(file);
file:write(data);
file:close();
end
FileSaveLoad()
local file = io.open("test.txt", "r");
assert(file);
local data = file:read("*a"); --读取所有内容
file:close();
file = io.open("test.lua", "w");
assert(file);
file:write(data);
file:close();
end
FileSaveLoad()
相关文章推荐
- table的三种遍历方式
- Tips on non-standard evaluation in R
- Using mutate from dplyr inside a function: getting around non-standard evaluation
- lua元表
- Lua的function、closure和upvalue
- 转:OpenResty最佳实践(推荐了解lua语法)
- 转: Lua 语言 15 分钟快速入门
- Lua Table 多字段排序
- Lua Day1
- 快速掌握Lua 5.3 —— 资源管理
- Lua内存泄露检测原理和weak_table弱引用
- Lua For Windows 环境配置及使sciTE支持中文
- Lua内存泄露检测原理
- lua table remove元素的问题
- lua 小数点后面几位
- BabeLua秒启调试补丁1.08,支持Quick, 支持VS2013和VS2015(2016.6.21更新)
- Proto-gen-lua 与 C# 对 Extension 的不同处理
- 2dx-lua游戏震屏效果&简单的lua-binding
- Lua脚本热更新
- lua 调用c模块