ตรวจสอบ สร้าง โคลน และแทนที่การปิด
ฟังก์ชันที่ใช้ได้
checkcaller
คืนว่า current Luau thread อยู่ใน Real caller context หรือไม่ function นี้ไม่รับ arguments และ push boolean result จาก the current caller context function ไม่ตรวจ Lua call stack หรือ function object
clonefunction
Creates and returns a separate function value for the function passed as the first argument. The argument must be a function.
comparefunctions
เปรียบเทียบ function values สองค่าโดยใช้ function identity ของมัน arguments ทั้งสองต้องเป็น functions function จะคืน boolean result ของ function identity(L, 1) == function identity(L, 2) ไม่เปรียบเทียบ function bytecode, source, behavior, hashes, upvalues หรือ newcclosure mappings comparefunction เป็น alias ของ function เดียวกัน
getfunctionhash
Returns an uppercase SHA384 hex digest derived from a Luau function. The argument must be a function, and C closures raise “Lua function expected”. If no hashable function content is available, the function returns nil.
hookfunction
hook target function ด้วย replacement function และคืน cloned copy ของ original target closure arguments ทั้งสองต้องเป็น functions function จะ flush pending C function swaps ก่อน จากนั้น cloning target ผ่าน function cloning เพิ่ม replacement closure หรือ mapped newcclosure target ของมันไปที่ hidden stack tracking เรียก FixCallstack สำหรับ target และ cloned original แล้ว patch target closure ผ่าน C closure, Luau closure หรือ newcclosure-specific path หาก target ยังไม่อยู่ใน hook records จะเก็บ cloned original ไว้ที่นั่นสำหรับ restorefunction returned function คือ cloned original closure
hookmetamethod
ค้นหา metamethod function บน value และ hook function นั้นผ่าน hookfunction first argument เป็น value ใดก็ได้ที่ raw metafield lookup รับได้ second argument ต้องเป็น string metamethod name และ third argument ต้องเป็น function replacement หาก raw metafield lookup หา named metafield ไม่พบ function จะ raise “Metamethod doesn’t exist” สำหรับ argument 2 หาก metafield มีอยู่แต่ไม่ใช่ function จะ raise “Metamethod isn’t a function” สำหรับ argument 2 เมื่อ metafield เป็น function hookmetamethod จะเรียก hookfunction โดยใช้ found metamethod function เป็น target และคืน cloned original closure ของ hookfunction
iscclosure
Returns whether the provided function is a C closure. The argument must be a function; passing any other type raises a type error. The function does not inspect executor ownership, source, bytecode, or upvalues.
isexecutorclosure
Returns whether the provided function is classified as executor-owned. The argument must be a function. The function does not inspect source text, debug names, bytecode hashes, or call stack ownership.
isfunctionhooked
Returns whether the provided function currently has a hook record. The argument must be a function.
ishiddenstack
Returns whether a function, or the function at a stack level, is marked as hidden. target must be a function or stack level number. Invalid stack levels raise “Level out of range”. isstackhidden is an alias.
islclosure
Returns whether the provided function is a Lua closure. The argument must be a function; passing a non-function raises a type error. isluaclosure is an alias.
isnewcclosure
Returns whether the provided function is a newcclosure-created C closure. The first argument must be a function; passing a non-function raises a type error. Documented usage is a single function argument; extra arguments are not part of the supported signature.
newcclosure
Returns a C closure for the provided function. If the function is already a C closure, the same function is returned. Passing a non-function raises a type error.
newlclosure
Returns a Luau closure that calls the provided function. The first argument must be a function.
restorefunction
คืนค่าหรือแทนที่ function โดยเรียก function hook operation ภายใน และไม่คืน values first argument ต้องเป็น function เมื่อมี function argument เดียว function จะหา the saved original function; หากไม่มี entry จะเกิด “Function is not hooked” จากนั้นเรียก function hook operation ด้วย hooked closure และ stored original closure ล้าง Lua stack และลบ restored closure ออกจาก hook records เมื่อใช้ stored original หาก second argument เป็น function ด้วย function จะถือว่า firstFunction เป็น original function ที่จะติดตั้ง และ secondFunction เป็น closure ที่จะ patch ในรูปแบบนี้จะไม่มี missing-original check กับค่า hook records ที่เก็บไว้ ค่าที่เก็บไว้จะถูกเปรียบเทียบเฉพาะระหว่าง final remove check เท่านั้น เท่านั้น non-function second arguments ถูกละเว้นโดย branch condition restorefunc และ restoreclosure เป็น aliases ของ function เดียวกัน
sethiddenstack
Marks or unmarks a function, or the function at a stack level, as hidden. target must be a function or stack level number. hidden defaults to true. Invalid stack levels raise “Level out of range”. setstackhidden is an alias.