Add note about how Lua nil is unsuitable as table key

Could add some context tracking in the future to allow rejecting nil in
a table key context.
This commit is contained in:
Kim Alvefur 2023-08-02 12:10:21 +02:00
parent 5b7c00aa62
commit f544580692

View File

@ -175,6 +175,7 @@ func (le *luaEncoder) encodeAny(writer io.Writer, node *yaml.Node) error {
case "!!str": case "!!str":
return le.encodeString(writer, node) return le.encodeString(writer, node)
case "!!null": case "!!null":
// TODO reject invalid use as a table key
return writeString(writer, "nil") return writeString(writer, "nil")
case "!!bool": case "!!bool":
// Yaml 1.2 has case variation e.g. True, FALSE etc but Lua only has // Yaml 1.2 has case variation e.g. True, FALSE etc but Lua only has