Check whether a table/metatable is read-only
is-readonlyCheck if a Luau table or metatable is locked read-only before attempting metatable hooks or edits, so you know whether setreadonly must be disabled first.
Instructions
Resolve a Luau expression to a table (or a metatable expression) and report whether it is locked read-only via isreadonly. Roblox marks core metatables (e.g. getrawmetatable(game)) and many security tables read-only so __index/__namecall can't be swapped; this tells you whether you'd need setreadonly(t, false) before any mutation would take effect. Use it as a safe, non-mutating pre-check before attempting metatable hooks or constant/upvalue edits — it changes nothing. Typical targets: a plain table from getgenv(), or 'getrawmetatable(game)' to confirm the global instance metatable is frozen. Requires isreadonly; returns { Target, TargetType, ReadOnly } or { error } when the value isn't a table or isreadonly is unavailable. Signature: { targetPath: string, threadContext: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client, resolved-target. Produces: structured-observation. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| targetPath | Yes | Luau expression resolving to the table or metatable to test, e.g. 'getgenv().SomeTable', 'getrawmetatable(game)', or 'getrawmetatable(game.Players.LocalPlayer)'. Evaluated as `return <targetPath>`. isreadonly only applies to tables — userdata/Instances will report an error. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |