local type,pcall,rawequal,tostring=type,pcall,rawequal,tostring local global_ls=loadstring local env=getgenv and getgenv() or _G local env_ls=env and env.loadstring local dbg=debug local info_ref=dbg and (dbg.info or dbg.getinfo) local dump_ref=string.dump local pcall_ref=pcall local getgenv_ref=getgenv local function native_loader(fn) if type(fn)~="function" then return false,"type" end local ok,chunk=pcall(fn,"return 0x5EC0A1") if not ok or type(chunk)~="function" then return false,"canary_load" end local ok2,value=pcall(chunk) if not ok2 or value~=0x5EC0A1 then return false,"canary_run" end if dump_ref then local dumped=pcall(dump_ref,fn) if dumped then return false,"dump" end end if info_ref then local got,info=pcall(info_ref,fn,"s") if got and info~=nil then if type(info)=="string" and info~="[C]" then return false,"info:"..tostring(info) end if type(info)=="table" and info.what and info.what~="C" then return false,"infotable" end end end return true end print("identity",rawequal(env_ls,global_ls),rawequal(pcall_ref,pcall),rawequal(getgenv_ref,getgenv)) print("info_ref",rawequal(info_ref,dbg and (dbg.info or dbg.getinfo))) print("dump_ref",rawequal(dump_ref,string.dump)) print("native",native_loader(global_ls)) print("global",type(global_ls),tostring(global_ls)) print("env",type(env_ls),tostring(env_ls)) print("info",tostring(info_ref)) print("dump",tostring(dump_ref))