参数
userdata
必填
要 hash 的 Script object。受支持的 ClassName 值是 ModuleScript、LocalScript、CoreScript,以及 RunContext Client 的 Script。
返回值
string | nil
stored bytecode bytes 的 uppercase SHA384 hex digest,或没有可用 embedded bytecode 时为 nil。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
返回 Roblox script object 的 stored bytecode string 的 uppercase SHA384 hex digest。argument 必须是 object。共享 bytecode reader 接受 ClassName 值 ModuleScript、LocalScript、CoreScript 和 Script。对于 Script,RunContext 必须是 Client。如果缺少 ClassName,function 会抛出 “Invalid Instance”。如果 ClassName 不是受支持的 script classes 之一,会抛出 “Script expected”。如果该值是另一个 RunContext 的 Script,会抛出 “Expected a Script with RunContext set to Client”。如果 embedded bytecode reference 无效,或 stored bytecode 长度为 8 bytes 或更少,function 返回 nil。否则,它会对确切的 stored bytecode bytes 计算 SHA384,并返回 uppercase hex string。function 不调用 DecompressBytecode,也不会对 decompressed bytecode 计算 hash。
getscripthash(script: userdata): string | nil
local targetScript
for _, descendant in ipairs(game:GetDescendants()) do
if descendant:IsA("LuaSourceContainer") then
targetScript = descendant
break
end
end
if targetScript then
local hash = getscripthash(targetScript)
print(hash)
end