--[[
Save Table to File
Load Table from File
v 1.0
Lua 5.2 compatible
Only Saves Tables, Numbers and Strings
Insides Table References are saved
Does not save Userdata, Metatables, Functions and indices of these
----------------------------------------------------
table.save( table , filename )
on failure: returns an error msg
----------------------------------------------------
table.load( filename or stringtable )
Loads a table that has been saved via the table.save function
on success: returns a previously saved table
on failure: returns as second argument an error msg
----------------------------------------------------
Licensed under the same terms as Lua itself.
]]--
do
-- declare local variables
--// exportstring( string )
--// returns a "Lua" portable version of the string
local function exportstring( s )
return string.format("%q", s)
Lua Save Table to File
最新推荐文章于 2021-12-23 17:50:21 发布
这篇博客介绍了如何在Lua中将表格数据保存到文件,通过table.save函数,可以将表格(tablename)写入到指定的文件(filename)中,便于后续通过require加载使用。
摘要由CSDN通过智能技术生成