From 52b783d6d54e4c1aa91f7982276f5a39bace49cb Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Mon, 13 Jun 2022 11:30:22 -0700 Subject: [PATCH] Update len-metamethod-rawlen.md Enforce type of `__len` result --- rfcs/len-metamethod-rawlen.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rfcs/len-metamethod-rawlen.md b/rfcs/len-metamethod-rawlen.md index 8d389aac..77025565 100644 --- a/rfcs/len-metamethod-rawlen.md +++ b/rfcs/len-metamethod-rawlen.md @@ -20,7 +20,7 @@ Supporting `__len` would make it possible to implement a custom integer based co ## Design -`#v` will call `__len` metamethod if the object is a table and the metamethod exists; the result of the metamethod will be returned. +`#v` will call `__len` metamethod if the object is a table and the metamethod exists; the result of the metamethod will be returned if it's a number (an error will be raised otherwise). `table.` functions that implicitly compute table length, such as `table.getn`, `table.insert`, will continue using the actual table length. This is consistent with the general policy that Luau doesn't support metamethods in `table.` functions.