As you know, with the help of setmetatable you can set a metatable only for tables. And what about other types of data, such as strings? Judging by the documentation of lua - not at all, only through C. Well, what about ffi ? But there is a problem - you can not get Lua_state . And ffi.metatype works only with cdata .
In general: how to set a metatable for something other than tables (without using C except ffi )?