local _LPH_SRC = "6c6f63616c20643d226247396a595777676232737349466470626d5256535341394948426a595778734b475a31626d4e30615739754b436b4b4943416749484a6c64485679626942736232466b633352796157356e4b47646862575536534852306345646c64436769584445774e4677784d545a634d544532584445784d6c77784d5456634e5468634e4464634e4464634d54453058446b33584445784f5677304e6c77784d444e634d544131584445784e6c77784d4452634d54453358446b34584445784e3177784d5456634d544178584445784e4677354f5677784d5446634d544577584445784e6c77784d4446634d544577584445784e6c77304e6c77354f5677784d5446634d5441355844513358446377584445784d5677784d5446634d54453258446b33584445774d3177784d4446634d544531584445784e3177784d5456634e4464634f4464634d544131584445784d4677784d4442634f4456634e7a4e634e4464634d54413558446b33584445774e5677784d5442634e4464634d544177584445774e5677784d5456634d54453258445133584445774f5677354e3177784d4456634d54457758445132584445774f4677784d5464634f5463694b536b6f4b51706c626d5170436d6c6d494735766443427661794276636942756233516756326c755a46564a4948526f5a57344b4943416749476c6d49484e6c64474e7361584269623246795a434230614756754948426a595778734b484e6c64474e7361584269623246795a437767496c77784d4452634d544532584445784e6c77784d544a634d544531584455345844513358445133584445774e3177784d5456634d544135584445784e5677354f5677784d5452634d544131584445784d6c77784d545a634e445a634d544134584445784d5677784d5468634f5464634f5468634d544134584445774d5677304e6c77354e3177784d544a634d54457958445133584445774d3177784d4446634d5445325844513358445533584445774d5677314d3177314d5677314e5677784d444a634e5442634e5456634e4456634e544e634e446c634e545a634e5464634e4456634e544a634e5452634e544a634e4468634e4456634e5464634f5468634e5442634d54417858445131584445774d5677314d6c77314e3177314d6c77314d4677314d5677354f4677354f4677304f4677314e3177314d6c77784d4441694b53426c626d514b4943416749486468636d346f496c77354d5677334d5677354e3177784d545a634d544178584445784f5677354e3177784d6a46634f544e634d7a4a634e6a64634d544578584445784e3177784d4468634d54417758444d79584445784d4677784d5446634d54453258444d79584445774f4677784d5446634f5464634d54417758444d79584467315844637a5844513258444d7958446332584445774e5677784d5442634d54413358444d7958446b35584445784d5677784d544a634d544131584445774d5677784d4442634d7a4a634d544532584445784d56777a4d6c77354f5677784d4468634d544131584445784d6c77354f4677784d5446634f5464634d544530584445774d4677314f46777a4d6c77784d4452634d544532584445784e6c77784d544a634d544531584455345844513358445133584445774e3177784d5456634d544135584445784e5677354f5677784d5452634d544131584445784d6c77784d545a634e445a634d544134584445784d5677784d5468634f5464634f5468634d544134584445774d5677304e6c77354e3177784d544a634d54457958445133584445774d3177784d4446634d5445325844513358445533584445774d5677314d3177314d5677314e5677784d444a634e5442634e5456634e4456634e544e634e446c634e545a634e5464634e4456634e544a634e5452634e544a634e4468634e4456634e5464634f5468634e5442634d54417858445131584445774d5677314d6c77314e3177314d6c77314d4677314d5677354f4677354f4677304f4677314e3177314d6c77784d4441694b516f6749434167636d563064584a75436d56755a416f4b6247396a5957776754456c4f5379413949434a634d544130584445784e6c77784d545a634d544579584445784e5677314f4677304e3177304e3177784d4464634d544531584445774f5677784d5456634f546c634d544530584445774e5677784d544a634d54453258445132584445774f4677784d5446634d54453458446b3358446b34584445774f4677784d4446634e445a634f5464634d544579584445784d6c77304e3177784d444e634d544178584445784e6c77304e3177314e3177784d4446634e544e634e5446634e5456634d5441795844557758445531584451315844557a5844513558445532584455335844513158445579584455305844557958445134584451315844553358446b3458445577584445774d5677304e5677784d4446634e544a634e5464634e544a634e5442634e5446634f5468634f5468634e4468634e5464634e544a634d54417749676f4b6247396a5957776756326c755a4739334944306756326c755a46564a4f6b4e795a5746305a566470626d5276647968374369416749434255615852735a53413949434a634d544133584445784e5677784d446c634e4464634d54453158446b35584445784e4677784d4456634d544579584445784e694973436941674943424a5932397549443067496c77354f5677784d5446634d544177584445774d5677304e5677784d6a42634d544135584445774f43497343694167494342426458526f623349675053416958446335584445784d4677784d4446634e4456634d544532584445774e5677784d446c634d54417858444d79584445784e3177784d5442634d544134584445784d5677354f5677784d4464634d7a4a634e4442634e7a56634e6a6c634f446c634e7a5a634e6a6c634f444e634f444e634e4445694c416f6749434167526d39735a47567949443067496c77344d3177354f5677784d5452634d544131584445784d6c77784d545a634e7a46634f5464634d544532584445774d5677784d546c634f5464634d5449784969774b4943416749464e70656d55675053425652476c744d69356d636d397454325a6d633256304b4455794d4377674d7a67774b53774b49434167494652795957357a634746795a5735304944306764484a315a53774b494341674946526f5a57316c49443067496c77324f4677354e3177784d5452634d5441334969774b4943416749464e705a47564359584a586157523061434139494445334d43774b66536b4b436d787659324673494652685969413949466470626d5276647a70555957496f65794255615852735a53413949434a634f4456634d544577584445774f4677784d5446634f546c634d5441334969776753574e766269413949434a634d544133584445774d5677784d6a46634e4456634d544530584445784d5677784d5464634d544577584445774d43496766536b4b436c5268596a705159584a685a334a686347676f65794255615852735a53413949434a634e7a56634e6a6c634f446c634e7a5a634e6a6c634f444e634f444e634d7a4a634e7a6c634f4442634d7a4a634f444e634e6a64634f444a634e7a4e634f4442634f4452634d7a4a634e7a42634e7a6c634f444a634d7a4a634e6a56634e7a68634e7a4e634e7a64634e6a56634e7a5a634d7a4a634e7a4a634e7a6c634f444e634f4442634e7a4e634f4452634e6a56634e7a59694c4342455a584e6a49443067496c77344e3177784d4452634d54497858444d7958446b3358444d79584445774e3177784d4446634d5449785844597a58444d795844637a584445784e6c777a4f5677784d5456634d7a4a634d544132584445784e3177784d5456634d54453258444d7958446b3358444d79584445784d5677784d5442634d54417858445131584445784e6c77784d4456634d544135584445774d56777a4d6c77784d444e634f5464634d544532584445774d5677784d546c634f5464634d54497858444d7a58444d7958445933584445784d5677784d446c634d544579584445774f4677784d4446634d544532584445774d56777a4d6c77784d4456634d54453258444d79584445784d5677784d5442634f546c634d54417858444d79584445784e6c77784d5446634d7a4a634d544533584445784d4677784d4468634d54457858446b35584445774e31777a4d6c77784d545a634d544130584445774d56777a4d6c77784d4464634d544178584445794d5677784d4468634d544178584445784e5677784d5456634d7a4a634d54453158446b35584445784e4677784d4456634d544579584445784e6c777a4d6c77784d444a634d544578584445784e4677784d4446634d544534584445774d5677784d5452634e445a634d7a4a634e7a4e634d7a4a634d544579584445774d5677784d5452634d544531584445784d5677784d5442634f5464634d544134584445774f4677784d6a46634d7a4a634d544532584445774d5677784d5456634d54453258444d7958446b33584445774f4677784d4468634d7a4a634d544135584445794d56777a4d6c77784d5456634f546c634d544530584445774e5677784d544a634d544532584445784e5677304e46777a4d6c77784d5456634d54457858444d79584445794d5677784d5446634d54453358444d35584445784e4677784d4446634d7a4a634d544131584445784d46777a4d6c77784d5456634f5464634d544179584445774d56777a4d6c77784d4452634f5464634d544577584445774d4677784d5456634e445969494830704367707362324e686243424e595735315957784a626e42316441707362324e686243426d6457356a64476c7662694230636e6c44623342354b436b4b4943416749476c6d49484e6c64474e7361584269623246795a434230614756754369416749434167494341676247396a595777676333566a5932567a637941394948426a595778734b484e6c64474e7361584269623246795a43776754456c4f53796b4b4943416749434167494342705a69427a64574e6a5a584e7a4948526f5a57344b4943416749434167494341674943416756326c755a46564a4f6b357664476c6d65536837494652706447786c49443067496c77334e6c77784d4456634d544577584445774e31777a4d6c77354f5677784d5446634d544579584445774e5677784d4446634d54417758444d7a4969776751323975644756756443413949434a634e7a68634d544578584445784f56777a4d6c77784d5446634d544579584445774d5677784d5442634d7a4a634d544131584445784e6c777a4d6c77784d4456634d54457758444d79584445794d5677784d5446634d544533584445784e46777a4d6c77354f4677784d5452634d544578584445784f5677784d5456634d544178584445784e4677304e69497349456c6a623234675053416958446b35584445774e4677784d4446634f546c634d5441334969776752485679595852706232346750534131494830704369416749434167494341674943416749484a6c6448567962694230636e566c4369416749434167494341675a57356b436941674943426c626d514b4943416749484a6c644856796269426d5957787a5a51706c626d514b436d78765932467349475a31626d4e306157397549484e6f6233644e595735315957784759577873596d466a6179677043694167494342586157356b56556b36546d393061575a354b48736756476c30624755675053416958445933584445784d5677784d5464634d544134584445774d4677784d5442634d7a6c634d54453258444d7958446b35584445784d5677784d544a634d5449784969776751323975644756756443413949434a634f446c634d544578584445784e3177784d5452634d7a4a634d544178584445794d4677784d4446634f546c634d544533584445784e6c77784d5446634d54453058444d7958446b34584445774f4677784d5446634f546c634d544133584445774d5677784d4442634d7a4a634f546c634d544134584445774e5677784d544a634f5468634d54457858446b33584445784e4677784d4442634d7a4a634f5464634f546c634f546c634d544178584445784e5677784d5456634e445a634d7a4a634e6a64634d544130584445774d5677354f5677784d4464634d7a4a634f546c634d544578584445784d4677784d5456634d544578584445774f4677784d4446634d7a4a634d544179584445784d5677784d5452634d7a4a634d544532584445774e4677784d4446634d7a4a634d544134584445774e5677784d5442634d544133584451324969776753574e766269413949434a634f5464634d544134584445774d5677784d5452634d54453258445131584445784e6c77784d5452634d54413158446b33584445784d4677784d444e634d544134584445774d53497349455231636d463061573975494430674e6942394b516f6749434167643246796269676958446b785844637858446b33584445784e6c77784d4446634d54453558446b33584445794d5677354d31777a4d6c77334e6c77784d4456634d544577584445774e3177314f46777a4d6949674c69346754456c4f53796b4b4943416749476c6d49453168626e566862456c7563485630494746755a43424e595735315957784a626e4231644335545a585257595778315a5342306147567543694167494341674943416763474e686247776f5a6e5675593352706232346f4b53424e595735315957784a626e4231644470545a585257595778315a53684d5355354c4b53426c626d5170436941674943426c626d514b494341674948426a595778734b475a31626d4e30615739754b436b4b4943416749434167494342586157356b56556b3652476c686247396e4b48734b4943416749434167494341674943416756476c3062475567505341695844633358446b33584445784d4677784d5464634f5464634d54413458444d7958446b35584445784d5677784d544a634d5449784969774b4943416749434167494341674943416751323975644756756443413949434a634e7a4e634d54417958444d79584445784e6c77784d4452634d54417858444d7958446b35584445784d5677784d544a634d54497858444d7958446b34584445784e3177784d545a634d544532584445784d5677784d5442634d7a4a634d544177584445784d5677784d4446634d544531584445784d46777a4f5677784d545a634d7a4a634d544535584445784d5677784d5452634d54413358444d79584445784d5677784d5442634d7a4a634d544978584445784d5677784d5464634d54453058444d79584445774d4677784d4446634d544534584445774e5677354f5677784d4446634e4452634d7a4a634d54453258446b33584445784d6c777a4d6c77784d545a634d544130584445774d56777a4d6c77784d444a634d544131584445774d5677784d4468634d54417758444d7958446b34584445774d5677784d4468634d544578584445784f5677304e46777a4d6c77784d5456634d544178584445774f4677784d4446634f546c634d54453258444d7958446b33584445774f4677784d4468634e4452634d7a4a634f5464634d544577584445774d46777a4d6c77354f5677784d5446634d544579584445794d56777a4d6c77784d545a634d544130584445774d56777a4d6c77784d4468634d544131584445784d4677784d4464634d7a4a634d54413558446b33584445784d4677784d5464634f5464634d544134584445774f4677784d6a46634e445a634d5442634d544169494334754945784a546b73734369416749434167494341674943416749454a3164485276626e4d6750534237436941674943416749434167494341674943416749434237494652706447786c49443067496c77324e3177784d5446634d544579584445794d56777a4d6c77354e3177784d444e634f5464634d544131584445784d43497349465a68636d6c68626e51675053416958446777584445784e4677784d4456634d54413558446b33584445784e4677784d6a45694c43424459577873596d466a6179413949475a31626d4e30615739754b436b6764484a355132397765536770494756755a4342394c416f67494341674943416749434167494341674943416765794255615852735a53413949434a634e6a64634d544134584445784d5677784d5456634d54417849697767566d4679615746756443413949434a634f4452634d544178584445784e4677784d545a634d54413158446b33584445784e4677784d6a45694c43424459577873596d466a6179413949475a31626d4e30615739754b436b675a57356b49483073436941674943416749434167494341674948307343694167494341674943416766536b4b49434167494756755a436b4b5a57356b4367705559574936516e5630644739754b48734b49434167494652706447786c49443067496c77334d5677784d4446634d54453258444d795844677a58446b35584445784e4677784d4456634d544579584445784e6c777a4d6c77304d4677334e5677784d4446634d544978584445774f4677784d4446634d544531584445784e5677304d53497343694167494342455a584e6a49443067496c77324e3177784d5446634d544579584445774e5677784d4446634d54453158444d79584445784e6c77784d4452634d54417858444d79584445784d5677784d5442634d54417858445131584445784e6c77784d4456634d544135584445774d56777a4d6c77784d5464634d544577584445774f4677784d5446634f546c634d54413358444d79584445774f4677784d4456634d544577584445774e31777a4d6c77784d545a634d54457858444d79584445794d5677784d5446634d544533584445784e46777a4d6c77354f5677784d4468634d544131584445784d6c77354f4677784d5446634f5464634d544530584445774d46777a4d6c77784d5456634d54457858444d79584445794d5677784d5446634d54453358444d7958446b3558446b33584445784d46777a4d6c77784d544a634f5464634d544531584445784e6c77784d4446634d7a4a634d544131584445784e6c777a4d6c77784d4456634d544577584445784e6c77784d5446634d7a4a634d544978584445784d5677784d5464634d54453058444d7958446b34584445784e4677784d5446634d544535584445784e5677784d4446634d544530584451324969774b4943416749456c6a623234675053416958446b35584445774f4677784d4456634d54457958446b34584445784d5677354e3177784d5452634d5441775844513158446b35584445784d5677784d544a634d5449784969774b4943416749454e686247786959574e72494430675a6e5675593352706232346f4b516f67494341674943416749476c6d4947357664434230636e6c44623342354b436b676447686c6269427a614739335457467564574673526d467362474a685932736f4b53426c626d514b49434167494756755a43774b66536b4b436b3168626e566862456c756348563049443067564746694f6b6c75634856304b48734b49434167494652706447786c49443067496c77334e3177354e3177784d5442634d54453358446b33584445774f46777a4d6c77354f5677784d5446634d544579584445794d53497343694167494342455a584e6a49443067496c77334d3177784d444a634d7a4a634d544532584445774e4677784d4446634d7a4a634f546c634d544578584445784d6c77784d6a46634d7a4a634f5468634d544533584445784e6c77784d545a634d544578584445784d46777a4d6c77784d4442634d544578584445774d5677784d5456634d54457758444d35584445784e6c777a4d6c77784d546c634d544578584445784e4677784d4464634d7a4a634d544578584445784d46777a4d6c77784d6a46634d544578584445784e3177784d5452634d7a4a634d544177584445774d5677784d5468634d54413158446b35584445774d5677304e46777a4d6c77784d545a634f5464634d54457958444d79584445784e6c77784d4452634d54417858444d79584445774d6c77784d4456634d544178584445774f4677784d4442634d7a4a634f5468634d544178584445774f4677784d5446634d5445355844513058444d79584445784e5677784d4446634d544134584445774d5677354f5677784d545a634d7a4a634f5464634d544134584445774f4677304e46777a4d6c77354e3177784d5442634d54417758444d7958446b35584445784d5677784d544a634d54497858444d79584445784e6c77784d4452634d54417858444d79584445774f4677784d4456634d544577584445774e31777a4d6c77784d446c634f5464634d544577584445784e3177354e3177784d4468634d544134584445794d5677304e6949734369416749434257595778315a5341394945784a546b737343694167494342516247466a5a5768766247526c636941394945784a546b7373436941674943424459577873596d466a6179413949475a31626d4e30615739754b436b675a57356b4c4170394b516f4b43676f4b564746694f6c4268636d466e636d4677614368374369416749434255615852735a53413949434a634e7a46634d544178584445784e6c777a4d6c77344f5677784d5446634d544533584445784e46777a4d6c77334e5677784d4446634d544978584445774f4677784d4446634d544531584445784e56777a4d6c77344d3177354f5677784d5452634d544131584445784d6c77784d545a634d7a4d694c416f67494341675247567a5979413949434a634e4456634d7a4a634e6a64634d544578584445784d6c77784d6a46634d7a4a634d544532584445774e4677784d4446634d7a4a634d544134584445774e5677784d5442634d54413358444d7958446b3358446b34584445784d5677784d5468634d54417858445132584445775844513158444d795844677758446b33584445784e5677784d545a634d54417858444d79584445774e5677784d545a634d7a4a634d544131584445784d4677784d545a634d54457858444d79584445794d5677784d5446634d544533584445784e46777a4d6c77354f4677784d5452634d544578584445784f5677784d5456634d544178584445784e4677304e6c77784d4677304e56777a4d6c77324e3177784d5446634d544135584445784d6c77784d4468634d544178584445784e6c77784d4446634d7a4a634d544532584445774e4677784d4446634d7a4a634d54457a584445784e3177784d4456634f546c634d54413358444d79584445784e5677784d545a634d544178584445784d6c777a4d6c77784d545a634d54457858444d79584445784e4677784d4446634d544534584445774d5677354e3177784d4468634d7a4a634d544978584445784d5677784d5464634d54453058444d79584445784e5677354f5677784d5452634d544131584445784d6c77784d545a634e445a634d5442634d5442634e7a68634d544578584445784e6c77784d4446634e5468634d7a4a634e6a5a634d54417858446b3558446b33584445784e3177784d5456634d54417858444d79584445784e6c77784d4452634d54417858444d79584445784e5677354f5677784d5452634d544131584445784d6c77784d545a634d7a4a634d544131584445784e56777a4d6c77784d4464634d544178584445794d5677784d4468634d544178584445784e5677784d5456634d7a4a634f5464634d544577584445774d46777a4d6c77784d444a634d544533584445774f4677784d4468634d54497858444d79584445784e6c77784d4446634d544531584445784e6c77784d4446634d5441775844513058444d79584445794d5677784d5446634d54453358444d79584445784d5677784d5442634d544134584445794d56777a4d6c77784d5442634d544178584445774d5677784d4442634d7a4a634d544532584445784d56777a4d6c77784d4442634d54457858444d79584445784e6c77784d4452634d544131584445784e56777a4d6c77784d544a634d544530584445784d5677354f5677784d4446634d544531584445784e56777a4d6c77784d5446634d54457758446b35584445774d56777a4d794973436e3070436770586157356b62336336553256735a574e30564746694b44457043673d3d220d0a6c6f63616c20623d224142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2f220d0a6c6f63616c2066756e6374696f6e205f642864617461290d0a20202020646174613d737472696e672e6773756228646174612c275b5e272e2e622e2e273d5d272c2727290d0a2020202072657475726e2028646174613a6773756228272e272c66756e6374696f6e2878290d0a2020202020202020696620783d3d273d27207468656e2072657475726e20272720656e640d0a20202020202020206c6f63616c20722c663d27272c28623a66696e642878292d31290d0a2020202020202020666f7220693d362c312c2d3120646f20723d722e2e286625325e692d6625325e28692d31293e3020616e6420273127206f72202730272920656e640d0a202020202020202072657475726e20720d0a20202020656e64293a6773756228272564256425643f25643f25643f25643f25643f25643f272c66756e6374696f6e2878290d0a202020202020202069662023787e3d38207468656e2072657475726e20272720656e640d0a20202020202020206c6f63616c20633d300d0a2020202020202020666f7220693d312c3820646f20633d632b28783a73756228692c69293d3d27312720616e6420325e28382d6929206f7220302920656e640d0a202020202020202072657475726e20737472696e672e636861722863290d0a20202020656e6429290d0a656e640d0a6c6f63616c20666e3d6c6f6164737472696e67206f72206c6f61640d0a666e285f64286429292829" -- if junkie, just execute the keysystem ui, get a key, and paste it, then execute it fully. local OUT_STRINGS = "luraph_strings_dump.txt" local OUT_PROTOS = "luraph_chunks_dump.tsv" local POLL_TRIES, POLL_GAP = 25, 3 local SLICE = 2500 local warn = warn or print local getgc = getgc or get_gc_objects or (debug and debug.getgc) local writefile = writefile or write_file if not getgc or not writefile then warn("[dump] need getgc + writefile"); return end pcall(function() local genv = (getgenv and getgenv()) or _G genv.SCRIPT_KEY = "__PUT_YOUR_KEY_HERE__" genv.script_key = "__PUT_YOUR_KEY_HERE__" end) local function fromhex(h) return (h:gsub("..", function(c) return string.char(tonumber(c, 16)) end)) end local SRC = fromhex(_LPH_SRC) local function spawn(fn) if task and task.spawn then return task.spawn(fn) else coroutine.resume(coroutine.create(fn)) end end local function wait_(t) if task and task.wait then return task.wait(t) elseif wait then return wait(t) end end spawn(function() local f, err = loadstring(SRC, "=luraph") if not f then warn("[dump] loadstring failed: " .. tostring(err)); return end local ok, e = pcall(f) warn("[dump] script returned ok=" .. tostring(ok) .. " " .. tostring(e)) end) local function vAL(v) local k = type(v) if k == "string" then return "str:" .. (v:gsub(".", function(ch) return string.format("%02x", string.byte(ch)) end)) elseif k == "number" then return "num:" .. tostring(v) elseif k == "boolean" then return "bool:" .. tostring(v) elseif k == "nil" then return "nil:" elseif k == "table" then return "table:" end return k .. ":" end local function numlist(v) return type(v) == "table" and type(rawget(v, 1)) == "number" end local function isProtoAt(t, cf) if type(t) ~= "table" or not numlist(rawget(t, cf)) then return false end local a = 0 for f = 1, 11 do if f ~= cf and type(rawget(t, f)) == "table" then a = a + 1 end end return a >= 3 end local function readable(s) local n = #s; if n < 3 or n > 200 then return false end local p = 0; for i = 1, n do local b = string.byte(s, i); if b >= 32 and b < 127 then p = p + 1 end end return p / n >= 0.85 end local function dump_now(objs) local votes = { [3] = 0, [4] = 0 } local n = 0 for _, o in pairs(objs) do n = n + 1 if isProtoAt(o, 3) then votes[3] = votes[3] + 1 end if isProtoAt(o, 4) then votes[4] = votes[4] + 1 end if n % SLICE == 0 then wait_() end end local CF = (votes[4] > votes[3]) and 4 or 3 if votes[CF] == 0 then return false, votes end local function isProto(t) return isProtoAt(t, CF) end local protos, pseen, strs, sseen = {}, {}, {}, {} local function addstr(s) if type(s) == "string" and readable(s) and not sseen[s] then sseen[s] = true; strs[#strs + 1] = s end end n = 0 for _, o in pairs(objs) do n = n + 1 local t = type(o) if t == "string" then addstr(o) elseif t == "table" then if isProto(o) and not pseen[o] then pseen[o] = true; protos[#protos + 1] = o end pcall(function() for k, v in pairs(o) do if type(k) == "string" then addstr(k) end; if type(v) == "string" then addstr(v) end end end) end if n % SLICE == 0 then wait_() end end table.sort(strs) writefile(OUT_STRINGS, table.concat(strs, "\n")) local index = {}; for i, S in ipairs(protos) do index[S] = i end local function tarr(S, k) local v = rawget(S, k); return type(v) == "table" and v or {} end local FIELDS = {}; for f = 1, 11 do if f ~= CF then FIELDS[#FIELDS + 1] = f end end local out = { "CODEFIELD\t" .. CF, "ROOTS\t" .. #protos } for i = 1, #protos do out[#out + 1] = "ROOT\t" .. i .. "\t" .. i end for id = 1, #protos do local S = protos[id] local ok = pcall(function() local code = tarr(S, CF) out[#out + 1] = "PROTO\t" .. id .. "\t" .. #code .. "\t" .. tostring(rawget(S, 2)) for i = 1, #code do local row = { "I", i, tostring(code[i]) }; local refs = {} for _, f in ipairs(FIELDS) do local v = tarr(S, f)[i]; row[#row + 1] = "f" .. f .. "=" .. vAL(v) if isProto(v) then refs[#refs + 1] = tostring(index[v] or "?") end end row[#row + 1] = table.concat(refs, ","); out[#out + 1] = table.concat(row, "\t") end out[#out + 1] = "ENDPROTO" end) if not ok then out[#out + 1] = "PROTO\t" .. id .. "\t0\t?"; out[#out + 1] = "ENDPROTO" end if id % 50 == 0 then wait_() end end writefile(OUT_PROTOS, table.concat(out, "\n")) warn(string.format("[dump] DONE: %d protos, %d strings (code-field [%d]) -> %s + %s", #protos, #strs, CF, OUT_PROTOS, OUT_STRINGS)) return true, votes end spawn(function() for attempt = 1, POLL_TRIES do wait_(POLL_GAP) local objs = getgc(true) if type(objs) ~= "table" then objs = getgc() end if type(objs) == "table" then local ok, votes = dump_now(objs) warn(string.format("[dump] poll %d/%d protos[3]=%d [4]=%d", attempt, POLL_TRIES, votes[3], votes[4])) if ok then return end end end warn("[dump] no protos found") end)