128 lines
3.1 KiB
Lua
128 lines
3.1 KiB
Lua
|
|
|
|||
|
|
-- <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>Ϸ<EFBFBD> <20>ͽ<EFBFBD><CDBD><EFBFBD>Ʈ
|
|||
|
|
function fileOpen( file_name )
|
|||
|
|
FileHandle = io.open( file_name, "w+" )
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
function fileClose()
|
|||
|
|
io.close( FileHandle )
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
-- <20><><EFBFBD>̺<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
tableDeep = -1
|
|||
|
|
|
|||
|
|
function printTab( offset )
|
|||
|
|
local count = tableDeep+offset
|
|||
|
|
for i = 1, count do
|
|||
|
|
FileHandle:write( string.format( "\t" ) )
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
function table_to_luafile( table_name, t )
|
|||
|
|
local t = t or _G[ table_name ] -- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Լ<EFBFBD><D4BC><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> _G <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><><EFBFBD>Ұ<EFBFBD> <20>ȴ<EFBFBD>.
|
|||
|
|
|
|||
|
|
tableDeep = tableDeep + 1
|
|||
|
|
if tableDeep == 0 then
|
|||
|
|
FileHandle:write( string.format( "%s = {}\n\n", table_name ) )
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
-- <20><><EFBFBD>̺<EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD>쿣 <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>쿣 <20>ƹ<EFBFBD><C6B9>͵<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
|||
|
|
if type(table_name) == "string" then
|
|||
|
|
printTab( 0 )
|
|||
|
|
FileHandle:write( string.format("%s = \n", table_name) )
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
printTab( 0 )
|
|||
|
|
FileHandle:write( string.format("{ \n") )
|
|||
|
|
|
|||
|
|
for k, v in pairs(t) do
|
|||
|
|
if type(v) == "string" then
|
|||
|
|
v = string.format( "%q", v ) -- %q <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20>ִ<EFBFBD> <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>.
|
|||
|
|
end
|
|||
|
|
if type(v) == "boolean" then
|
|||
|
|
if v then
|
|||
|
|
v = "true"
|
|||
|
|
else
|
|||
|
|
v = "false"
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
if type(v) == "table" then -- <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̺<EFBFBD><CCBA><EFBFBD> <20><>
|
|||
|
|
table_to_luafile( k, v ) -- Ű <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ڰ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>ְ<EFBFBD> <20><><EFBFBD>ڰ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>ְ<EFBFBD>.
|
|||
|
|
elseif type(k) == "number" then -- Ű<><C5B0> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>,
|
|||
|
|
printTab( 1 )
|
|||
|
|
FileHandle:write( string.format( "%f,\n", v ) )
|
|||
|
|
elseif type(v) == "number" then -- <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>϶<EFBFBD>,
|
|||
|
|
printTab( 1 )
|
|||
|
|
FileHandle:write( string.format( "%s = %f,\n", k, v ) )
|
|||
|
|
else
|
|||
|
|
printTab( 1 )
|
|||
|
|
FileHandle:write( string.format( "%s = %s,\n", k, v ) )
|
|||
|
|
end
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
printTab( 0 )
|
|||
|
|
FileHandle:write( "}" )
|
|||
|
|
tableDeep = tableDeep - 1
|
|||
|
|
|
|||
|
|
if tableDeep ~= -1 then
|
|||
|
|
FileHandle:write( "," )
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
FileHandle:write( "\n" )
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
-- <20><>Ȯ<EFBFBD><C8AE> <20><><EFBFBD>̺<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
function GetTableSize( table )
|
|||
|
|
local size = 0
|
|||
|
|
for _, _ in pairs(table) do
|
|||
|
|
size = size + 1
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
return size
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
-- <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
|||
|
|
function CallStack()
|
|||
|
|
local info = debug.getinfo( 3 )
|
|||
|
|
return info.source..":"..info.currentline.." "..info.name.."()"
|
|||
|
|
end
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
-- if type(v) == "table" then
|
|||
|
|
-- if type(k) == "number" then
|
|||
|
|
-- table_to_luafile( table_name .. "[" .. k .. "]", v )
|
|||
|
|
-- else
|
|||
|
|
-- table_to_luafile( table_name .. "." .. k, v )
|
|||
|
|
-- end
|
|||
|
|
-- else
|
|||
|
|
-- if type(k) == "number" then
|
|||
|
|
-- print( table_name .. "[" ..k.. "] = " .. v )
|
|||
|
|
-- else
|
|||
|
|
-- print( table_name .. "." .. k .. " = " .. v )
|
|||
|
|
-- end
|
|||
|
|
-- end
|
|||
|
|
-- end
|
|||
|
|
|
|||
|
|
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|||
|
|
-- tt = {
|
|||
|
|
-- 100,
|
|||
|
|
-- {
|
|||
|
|
-- 1,
|
|||
|
|
-- 2,
|
|||
|
|
-- 3
|
|||
|
|
-- },
|
|||
|
|
-- inner = {
|
|||
|
|
-- 100,
|
|||
|
|
-- "<22><><EFBFBD>ڿ<EFBFBD>",
|
|||
|
|
-- x = 10,
|
|||
|
|
-- alive = false
|
|||
|
|
-- },
|
|||
|
|
-- x = 10
|
|||
|
|
-- }
|