]> git.lizzy.rs Git - mt.git/blobdiff - stack.go
Add high-level protocol (de)serialization
[mt.git] / stack.go
index 4e7cc18c57a2d566b7c7a26367a9767c1df84e15..d9306047d94687cb7ecabda8f0dacbb82709d60d 100644 (file)
--- a/stack.go
+++ b/stack.go
@@ -1,5 +1,8 @@
-// In this file, JSON refers to WTF-JSON, a variant of JSON used by Minetest
+// In this file, JSON refers to WTF-JSON.
+//
+// BUG(mt): Itemstrings use variant of JSON called WTF-JSON
 // where \u00XX escapes in string literals act like Go's \xXX escapes.
+// This should not be fixed because it would break existing items.
 
 package mt
 
@@ -22,6 +25,10 @@ type Item struct {
        ItemMeta
 }
 
+// String returns the Stack's itemstring.
+//
+// BUG(mt): The term itemstring is somewhat misleading, because
+// an itemstring represents a stack of items, not a single item.
 func (s Stack) String() string {
        if s.Count == 0 {
                return ""
@@ -83,6 +90,7 @@ func jsonStr(s string) string {
        return b.String()
 }
 
+// Scan scans an itemstring, implementing the fmt.Scanner interface.
 func (stk *Stack) Scan(state fmt.ScanState, verb rune) (err error) {
        *stk = Stack{}