Luau: __tostring accepts a string

Right now __tostring accepts a function. This is particularly annoying if you want to return a static string value.

t = setmetatable({}, {
   __tostring = function() return "name" end
})

I want to be able to set the value to the static string value directly.

t = setmetatable({}, {
   __tostring = "name"
})
7 Likes

It might be a better idea to file an Pull Request with this RFC template on the GitHub Repo if you want a faster response

1 Like