Set metatable of primitive types?

I was playing around with this module that converts Javascript ES6 code to Lua Castl, But I noticed the module wouldn’t work in Roblox because one of the lines uses the debug.setmetatable() method which is available in plain Lua but not Roblox’s version of Lua. This method allows metatables to be set on primitive types such as numbers, booleans, functions, nil, etc. I was wondering if there was some workaround or any other way to set a metatable on a primitive instead of only being able to set them on table instances with the setmetatable() method.

You can create a userdata with a metatable using newproxy. But other than that, what you’re trying to accomplish isn’t possible unless you decide to use metamethods to give the tables the same behavior as primitive types.