Browse Source

Add List type. Add go.mod file.

Beoran 2 years ago
parent
commit
0e2b09d158
2 changed files with 17 additions and 0 deletions
  1. 3 0
      go.mod
  2. 14 0
      selsl/value/value.go

+ 3 - 0
go.mod

@@ -0,0 +1,3 @@
+module src.eruta.nl/beoran/selsl
+
+go 1.16

+ 14 - 0
selsl/value/value.go

@@ -89,5 +89,19 @@ func (i Int) String() string {
 	return fmt.Sprintf("%d", i.Value)
 }
 
+type List struct {
+	Object
+}
+
+func NewList(value int64, id int, name string,
+	parent Value, members ...Value) List {
+	return List{Object: NewObject(id, name, IntType, parent, members...)}
+}
+
+func (l List) String() string {
+	return fmt.Sprintf("[%v]", l.members)
+}
+
 var _ Value = String{}
 var _ Value = Int{}
+var _ Value = List{}