https://github.com/nyaosorg/glua-ole
The bridge library between GopherLua and go-ole
https://github.com/nyaosorg/glua-ole
go go-ole gopher-lua lua windows
Last synced: 3 months ago
JSON representation
The bridge library between GopherLua and go-ole
- Host: GitHub
- URL: https://github.com/nyaosorg/glua-ole
- Owner: nyaosorg
- License: mit
- Created: 2019-02-17T13:19:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-04-02T05:16:13.000Z (9 months ago)
- Last Synced: 2025-08-17T01:12:07.187Z (4 months ago)
- Topics: go, go-ole, gopher-lua, lua, windows
- Language: Go
- Homepage: https://pkg.go.dev/github.com/nyaosorg/glua-ole
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
glua-ole
========
The bridge library between [GopherLua](https://github.com/yuin/gopher-lua)
and [go-ole](https://github.com/go-ole/go-ole).
Using
------
```go
package main
import (
"fmt"
"os"
"github.com/yuin/gopher-lua"
"github.com/nyaosorg/glua-ole"
)
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)
}
}
```
- `local OBJ=create_object()` creates OLE-Object
- `OBJ:method(...)` calls method
- `OBJ:_get("PROPERTY")` returns the value of the property.
- `OBJ:_set("PROPERTY",value)` sets the value to the property.
- `OBJ:_iter()` returns an enumerator of the collection.
- `OBJ:_release()` releases the COM-instance.
- `local N=to_ole_integer(10)` creates the integer value for OLE.