All pastes #516940 Raw Edit

asd

public lua v1 · immutable
#516940 ·published 2007-05-28 22:12 UTC
rendered paste body
function xa.Serialize( tab )	retval = "{ "	for k,v in pairs(tab) do		if type(k) == "string" && (string.find(k," :: ") or string.find(k, " ;; ")) then			xa.log( "You can't send strings containing to colons or two semicolons!", 3 )		elseif type(k) == "string" then			retval = retval .. string.format("%q",k).." :: "		elseif type(k) == "number" then			retval = retval .. k .. " :: "		end				if type(v) == "string" && (string.find(v," :: ") or string.find(v, " ;; ")) then			xa.log( "You can't send "..v .. "!", 5 )		elseif type(v) == "string" then			retval = retval .. string.format("%q",v).." ;; "		elseif type(v) == "number" then			retval = retval .. v .. " ;; "		elseif type(v) == "Vector" then			retval = retval .. "v" .. v.x .. " " .. v.y .. " " .. v.z .. " ;; "		elseif type(v) == "Angle" then			retval = retval .. "a" .. v.p .. " " .. v.y.. " " .. v.r .. " ;; "		elseif (type(v) == "Entity" or type(v) == "Player") && v:IsValid() then			retval = retval .. "e" .. v:EntIndex() .. " ;; "		elseif type(v) == "boolean" then			retval = retval .. "b" .. v .. " ;; "		elseif type(v) == "Color" then			retval = retval .. "c" .. v.r .. " " .. v.g .. " " .. v.b .. " " .. v.a .. " ;; "		elseif type(v) == "table" then			retval = retval .. xa.Serialize( v ) .. " ;; "		else			xa.log( "Tried to serialize unknown type! What is " .. tostring(v) .. "?", 3 )		end	end		retval = retval .. "}"end