-
Notifications
You must be signed in to change notification settings - Fork 0
/
example1.go
37 lines (31 loc) · 705 Bytes
/
example1.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//go:build ignore
// +build ignore
package main
import (
"fmt"
"os"
"github.com/nyaosorg/glua-ole"
"github.com/yuin/gopher-lua"
)
func main() {
L := lua.NewState()
defer L.Close()
L.SetGlobal("create_object", L.NewFunction(ole.CreateObject))
L.SetGlobal("to_ole_integer", L.NewFunction(ole.ToOleInteger))
err := L.DoString(`
local fsObj = create_object("Scripting.FileSystemObject")
local folder= fsObj:GetFolder("C:\\")
local files = folder:_get("Files")
print("count=",files:_get("Count"))
for f in files:_iter() do
print(f:_get("Name"))
f:_release()
end
folder:_release()
files:_release()
fsObj:_release()
`)
if err != nil {
fmt.Fprintln(os.Stderr, err)
}
}