Skip to content

The bridge library between GopherLua and go-ole

Notifications You must be signed in to change notification settings

nyaosorg/glua-ole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glua-ole

The bridge library between GopherLua and go-ole.

Using

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.

Releases

No releases published

Packages

No packages published

Languages