Adds string-buf to display and display-lines
This commit is contained in:
parent
7f3ec19674
commit
d312f24af0
20
lib.go
20
lib.go
@ -745,10 +745,7 @@ var stdLibrary = vars{
|
||||
}
|
||||
return true
|
||||
case *IOHandle:
|
||||
if v.Open {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return v.Open {
|
||||
case []expression:
|
||||
if len(v) > 0 {
|
||||
return true
|
||||
@ -805,6 +802,13 @@ var stdLibrary = vars{
|
||||
switch val := a[i].(type) {
|
||||
case string:
|
||||
out.WriteString(val)
|
||||
case *IOHandle:
|
||||
buf, ok := i.Obj.(*strings.Builder)
|
||||
if ok {
|
||||
out.WriteString(buf.String())
|
||||
} else {
|
||||
out.WriteString(String(val))
|
||||
}
|
||||
default:
|
||||
out.WriteString(String(val))
|
||||
}
|
||||
@ -819,6 +823,14 @@ var stdLibrary = vars{
|
||||
case string:
|
||||
out.WriteString(val)
|
||||
out.WriteRune('\n')
|
||||
case *IOHandle:
|
||||
buf, ok := i.Obj.(*strings.Builder)
|
||||
if ok {
|
||||
out.WriteString(buf.String())
|
||||
} else {
|
||||
out.WriteString(String(val))
|
||||
}
|
||||
out.WriteRune('\n')
|
||||
default:
|
||||
out.WriteString(String(val))
|
||||
out.WriteRune('\n')
|
||||
|
Loading…
Reference in New Issue
Block a user