Some documentation improvements

This commit is contained in:
2024-03-25 17:37:58 -04:00
parent bb83837377
commit 0e43ca6568
2 changed files with 48 additions and 11 deletions

View File

@@ -171,7 +171,7 @@ public:
// Add default values for all builtin persistent variables.
//
// For each builtin default (plane, xyz, facing, bp, model)
// For each builtin default (plane, xyz, facing, bp)
//
// - Will generate an error if a value is already present,
// but the present value is of the wrong type.
@@ -224,6 +224,22 @@ public:
// Parse a string, for unit testing.
//
// This parses a simple notation designed to facilitate writing unit tests.
// The notation looks like this:
//
// parse("plane=earth xyz=1,2,3 action:jump");
//
// Determining the type of the value is done as follows: First, try
// interpreting it as boolean true or false. If that fails,
// try interpreting it as a number. If that fails, try interpreting it as
// a coordinate. If all else fails, it's a string. Obviously, this is a
// limited approach: for example, there's no way to express the string "123"
// because "123" will get interpreted as a number. But that's ok, since this
// is purely intended for unit testing.
//
// Key-value pairs can have either an equal sign or a colon. If it's an equal
// sign, the persistent bit is set, colon means not persistent.
//
void parse(std::string_view s);
void clear_and_parse(std::string_view s);