ole

package module
v0.0.0-...-b885836 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2025 License: MIT Imports: 7 Imported by: 1

README

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateObject

func CreateObject(L *lua.LState) int

CreateObject creates *lua.LState-Object to access COM

func ToOleInteger

func ToOleInteger(L *lua.LState) int

ToOleInteger converts LNumber to integer which can be used by OLE parameter only.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL