Skip to content

Commit

Permalink
More exact correspondence of getmetatatable to vanilla Lua (#1527)
Browse files Browse the repository at this point in the history
* More exact correspondence of getmetatatable to vanilla Lua

* fix docs
  • Loading branch information
foul11 authored Sep 28, 2023
1 parent f79a3bf commit f5b0377
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lua/starfall/libs_sh/builtins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ builtins_library.isbool = isbool
-- @return boolean If the object is a function or not
builtins_library.isfunction = isfunction

--- Returns the metatable of an object. Doesn't work on most internal metatables
-- @param table tbl Table to get metatable of
-- @return table The metatable of tbl
--- Returns the metatable of an object or nil.
-- Doesn't work on most internal metatables.
-- For any types other than table, nil will be returned.
-- @param any tbl Table to get metatable of
-- @return table? The metatable of tbl
builtins_library.getmetatable = function(tbl)
checkluatype(tbl, TYPE_TABLE)
if TypeID(tbl) ~= TYPE_TABLE then return end
return getmetatable(tbl)
end

Expand Down

0 comments on commit f5b0377

Please sign in to comment.