interfaces

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Code generated by gobindlua; DO NOT EDIT.

Code generated by gobindlua; DO NOT EDIT.

Code generated by gobindlua; DO NOT EDIT.

Code generated by gobindlua; DO NOT EDIT.

Example
package main

import (
	"log"

	"github.com/ChrisTrenkamp/gobindlua"
	lua "github.com/yuin/gopher-lua"
)

const script = `
local mammals = mammal_list.new()
mammals.pet = dog.new()
mammals.non_pets = { lion.new(), human.new() }

print("My pet says: " .. mammals.pet:sound())
print("The other mammals say:")
for i=1,#mammals.non_pets,1 do
	print(mammals.non_pets[i]:sound())
end
`

func main() {
	L := lua.NewState()
	defer L.Close()

	gobindlua.Register(L, Dog{}, Lion{}, Human{}, MammalList{})

	if err := L.DoString(script); err != nil {
		log.Fatal(err)
	}

}
Output:

My pet says: bark
The other mammals say:
rawr
burp

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dog

type Dog struct{}

func NewDog

func NewDog() Dog

func (*Dog) LuaMetatableType

func (r *Dog) LuaMetatableType() string

func (Dog) RegisterLuaType

func (goType Dog) RegisterLuaType(L *lua.LState)

func (Dog) Sound

func (d Dog) Sound() string

type Human

type Human struct{}

func NewHuman

func NewHuman() Human

func (*Human) LuaMetatableType

func (r *Human) LuaMetatableType() string

func (Human) RegisterLuaType

func (goType Human) RegisterLuaType(L *lua.LState)

func (Human) Sound

func (h Human) Sound() string

type Lion

type Lion struct{}

func NewLion

func NewLion() Lion

func (*Lion) LuaMetatableType

func (r *Lion) LuaMetatableType() string

func (Lion) RegisterLuaType

func (goType Lion) RegisterLuaType(L *lua.LState)

func (Lion) Sound

func (c Lion) Sound() string

type Mammal

type Mammal interface {
	Sound() string
	gobindlua.LuaUserData
}

type MammalList

type MammalList struct {
	Pet     Mammal
	NonPets []Mammal
}

func NewMammalList

func NewMammalList() MammalList

func (*MammalList) LuaMetatableType

func (r *MammalList) LuaMetatableType() string

func (MammalList) RegisterLuaType

func (goType MammalList) RegisterLuaType(L *lua.LState)

Jump to

Keyboard shortcuts

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