From fe4583127f0aaf631b05ad3dff7ebb0126314cf2 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 16 Apr 2024 07:31:43 -0700 Subject: fix: vim.validate() order is not deterministic #28377 Problem: The order of the validation performed by vim.validate() is unpredictable. - harder to write reliable tests. - confusing UX because validation result might return different errors randomly. Solution: Iterate the input using `vim.spairs()`. Future: Ideally, the caller could provide an "ordered dict". --- runtime/doc/lua.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index c760e762ee..2c0307a409 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2376,7 +2376,8 @@ vim.trim({s}) *vim.trim()* • https://www.lua.org/pil/20.2.html vim.validate({opt}) *vim.validate()* - Validates a parameter specification (types and values). + Validates a parameter specification (types and values). Specs are + evaluated in alphanumeric order, until the first failure. Usage example: >lua function user.new(name, age, hobbies) -- cgit