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 dog = require "dog"
local lion = require "lion"
local human = require "human"
local mammal_list = require "mammal_list"
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 (*Dog) LuaMetatableType ¶
func (*Dog) LuaModuleName ¶ added in v0.0.9
func (*Dog) LuaRegisterGlobalMetatable ¶ added in v0.0.9
type Human ¶
type Human struct{}
func (*Human) LuaMetatableType ¶
func (*Human) LuaModuleLoader ¶ added in v0.0.9
func (*Human) LuaModuleName ¶ added in v0.0.9
func (*Human) LuaRegisterGlobalMetatable ¶ added in v0.0.9
type Lion ¶
type Lion struct{}
func (*Lion) LuaMetatableType ¶
func (*Lion) LuaModuleLoader ¶ added in v0.0.9
func (*Lion) LuaModuleName ¶ added in v0.0.9
func (*Lion) LuaRegisterGlobalMetatable ¶ added in v0.0.9
type Mammal ¶
type Mammal interface {
Sound() string
gobindlua.LuaUserData
}
type MammalList ¶
func NewMammalList ¶
func NewMammalList() MammalList
func (*MammalList) LuaMetatableType ¶
func (r *MammalList) LuaMetatableType() string
func (*MammalList) LuaModuleLoader ¶ added in v0.0.9
func (goType *MammalList) LuaModuleLoader(L *lua.LState) int
func (*MammalList) LuaModuleName ¶ added in v0.0.9
func (goType *MammalList) LuaModuleName() string
func (*MammalList) LuaRegisterGlobalMetatable ¶ added in v0.0.9
func (goType *MammalList) LuaRegisterGlobalMetatable(L *lua.LState)
Click to show internal directories.
Click to hide internal directories.