golua

package module
v0.0.0-...-5a5ec56 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2012 License: MIT Imports: 2 Imported by: 3

README

README for Lua 5.1

See INSTALL for installation instructions.
See HISTORY for a summary of changes since the last released version.

* What is Lua?
  ------------
  Lua is a powerful, light-weight programming language designed for extending
  applications. Lua is also frequently used as a general-purpose, stand-alone
  language. Lua is free software.

  For complete information, visit Lua's web site at http://www.lua.org/ .
  For an executive summary, see http://www.lua.org/about.html .

  Lua has been used in many different projects around the world.
  For a short list, see http://www.lua.org/uses.html .

* Availability
  ------------
  Lua is freely available for both academic and commercial purposes.
  See COPYRIGHT and http://www.lua.org/license.html for details.
  Lua can be downloaded at http://www.lua.org/download.html .

* Installation
  ------------
  Lua is implemented in pure ANSI C, and compiles unmodified in all known
  platforms that have an ANSI C compiler. In most Unix-like platforms, simply
  do "make" with a suitable target. See INSTALL for detailed instructions.

* Origin
  ------
  Lua is developed at Lua.org, a laboratory of the Department of Computer
  Science of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro
  in Brazil).
  For more information about the authors, see http://www.lua.org/authors.html .

(end of README)

Documentation

Index

Constants

View Source
const (
	LUA_VERSION        = C.LUA_VERSION
	LUA_RELEASE        = C.LUA_RELEASE
	LUA_VERSION_NUM    = C.LUA_VERSION_NUM
	LUA_COPYRIGHT      = C.LUA_COPYRIGHT
	LUA_AUTHORS        = C.LUA_AUTHORS
	LUA_MULTRET        = C.LUA_MULTRET
	LUA_REGISTRYINDEX  = C.LUA_REGISTRYINDEX
	LUA_ENVIRONINDEX   = C.LUA_ENVIRONINDEX
	LUA_GLOBALSINDEX   = C.LUA_GLOBALSINDEX
	LUA_YIELD          = C.LUA_YIELD
	LUA_ERRRUN         = C.LUA_ERRRUN
	LUA_ERRSYNTAX      = C.LUA_ERRSYNTAX
	LUA_ERRMEM         = C.LUA_ERRMEM
	LUA_ERRERR         = C.LUA_ERRERR
	LUA_TNONE          = C.LUA_TNONE
	LUA_TNIL           = C.LUA_TNIL
	LUA_TBOOLEAN       = C.LUA_TBOOLEAN
	LUA_TLIGHTUSERDATA = C.LUA_TLIGHTUSERDATA
	LUA_TNUMBER        = C.LUA_TNUMBER
	LUA_TSTRING        = C.LUA_TSTRING
	LUA_TTABLE         = C.LUA_TTABLE
	LUA_TFUNCTION      = C.LUA_TFUNCTION
	LUA_TUSERDATA      = C.LUA_TUSERDATA
	LUA_TTHREAD        = C.LUA_TTHREAD
	LUA_MINSTACK       = C.LUA_MINSTACK
	LUA_GCSTOP         = C.LUA_GCSTOP
	LUA_GCRESTART      = C.LUA_GCRESTART
	LUA_GCCOLLECT      = C.LUA_GCCOLLECT
	LUA_GCCOUNT        = C.LUA_GCCOUNT
	LUA_GCCOUNTB       = C.LUA_GCCOUNTB
	LUA_GCSTEP         = C.LUA_GCSTEP
	LUA_GCSETPAUSE     = C.LUA_GCSETPAUSE
	LUA_GCSETSTEPMUL   = C.LUA_GCSETSTEPMUL
	LUA_HOOKCALL       = C.LUA_HOOKCALL
	LUA_HOOKRET        = C.LUA_HOOKRET
	LUA_HOOKLINE       = C.LUA_HOOKLINE
	LUA_HOOKCOUNT      = C.LUA_HOOKCOUNT
	LUA_HOOKTAILRET    = C.LUA_HOOKTAILRET
	LUA_MASKCALL       = C.LUA_MASKCALL
	LUA_MASKRET        = C.LUA_MASKRET
	LUA_MASKLINE       = C.LUA_MASKLINE
	LUA_MASKCOUNT      = C.LUA_MASKCOUNT
	LUA_ERRFILE        = C.LUA_ERRFILE
	LUA_NOREF          = C.LUA_NOREF
	LUA_REFNIL         = C.LUA_REFNIL
	LUA_FILEHANDLE     = C.LUA_FILEHANDLE
	LUA_COLIBNAME      = C.LUA_COLIBNAME
	LUA_TABLIBNAME     = C.LUA_TABLIBNAME
	LUA_IOLIBNAME      = C.LUA_IOLIBNAME
	LUA_OSLIBNAME      = C.LUA_OSLIBNAME
	LUA_STRLIBNAME     = C.LUA_STRLIBNAME
	LUA_MATHLIBNAME    = C.LUA_MATHLIBNAME
	LUA_DBLIBNAME      = C.LUA_DBLIBNAME
	LUA_LOADLIBNAME    = C.LUA_LOADLIBNAME
)

Variables

This section is empty.

Functions

func ArgCheck

func ArgCheck(L *State, cond bool, narg int, extramsg string)

func ArgError

func ArgError(L *State, narg int, extramsg string) int

func CallMeta

func CallMeta(L *State, obj int, e string) int

func CheckAny

func CheckAny(L *State, narg int)

func CheckInteger

func CheckInteger(L *State, narg int) int

func CheckNumber

func CheckNumber(L *State, narg int) float64

func CheckOption

func CheckOption(L *State, narg int, def string, lst []string) int

func CheckString

func CheckString(L *State, narg int) string

func CheckType

func CheckType(L *State, narg int, t int)

func CheckUdata

func CheckUdata(L *State, narg int, tname string) unsafe.Pointer

func FmtError

func FmtError(L *State, fmt string, args ...interface{}) int

luaL_error becomes FmtError because of lua_error

func GSub

func GSub(L *State, s string, p string, r string) string

func GetMetaField

func GetMetaField(L *State, obj int, e string) bool

returns false if no such metatable or no such field

func LGetMetaTable

func LGetMetaTable(L *State, tname string)

TODO: rename better... clashes with lua_getmetatable

func LTypename

func LTypename(L *State, index int) string

TODO: rename better

func TypeError

func TypeError(L *State, narg int, tname string) int

TODO: decide if we actually want this renamed

func Unref

func Unref(L *State, t int, ref int)

func Where

func Where(L *State, lvl int)

func XMove

func XMove(from *State, to *State, n int)

Types

type Alloc

type Alloc func(ptr unsafe.Pointer, osize uint, nsize uint) unsafe.Pointer

type GoFunction

type GoFunction func(*State) int

type Reader

type Reader func(L *State, data interface{}) []byte

like lua reader, but the return slice has the size, so does we do not need it to be an out param

type State

type State struct {
	// contains filtered or unexported fields
}

wrapper to keep cgo from complaining about incomplete ptr type

func NewState

func NewState() *State

func NewStateAlloc

func NewStateAlloc(f Alloc) *State

NOTE: lua_newstate becomes NewStateAlloc whereas

luaL_newstate becomes NewState

func (*State) AtPanic

func (L *State) AtPanic(panicf GoFunction) (oldpanicf GoFunction)

func (*State) Call

func (L *State) Call(nargs int, nresults int)

func (*State) CheckStack

func (L *State) CheckStack(extra int) bool

func (*State) Close

func (L *State) Close()

func (*State) Concat

func (L *State) Concat(n int)

func (*State) CreateTable

func (L *State) CreateTable(narr int, nrec int)

func (*State) DoFile

func (L *State) DoFile(filename string) bool

true if no errors, false otherwise

func (*State) DoString

func (L *State) DoString(str string) bool

true if no errors, false otherwise

func (*State) Dump

func (L *State) Dump(writer Writer, data interface{}) int

TODO: data be a slice?

func (*State) Equal

func (L *State) Equal(index1, index2 int) bool

func (*State) Error

func (L *State) Error() int

func (*State) GC

func (L *State) GC(what, data int) int

func (*State) GetField

func (L *State) GetField(index int, k string)

func (*State) GetGlobal

func (L *State) GetGlobal(name string)

func (*State) GetMetaTable

func (L *State) GetMetaTable(index int) bool

func (*State) GetTable

func (L *State) GetTable(index int)

func (*State) GetTop

func (L *State) GetTop() int

func (*State) GetfEnv

func (L *State) GetfEnv(index int)

func (*State) GoPCall

func (L *State) GoPCall(fun GoFunction, ud interface{}) int

CPcall replacement

func (*State) Insert

func (L *State) Insert(index int)

func (*State) IsBoolean

func (L *State) IsBoolean(index int) bool

func (*State) IsFunction

func (L *State) IsFunction(index int) bool

func (*State) IsGoFunction

func (L *State) IsGoFunction(index int) bool

func (*State) IsLightUserdata

func (L *State) IsLightUserdata(index int) bool

func (*State) IsNil

func (L *State) IsNil(index int) bool

func (*State) IsNone

func (L *State) IsNone(index int) bool

func (*State) IsNoneOrNil

func (L *State) IsNoneOrNil(index int) bool

func (*State) IsNumber

func (L *State) IsNumber(index int) bool

func (*State) IsString

func (L *State) IsString(index int) bool

func (*State) IsTable

func (L *State) IsTable(index int) bool

func (*State) IsThread

func (L *State) IsThread(index int) bool

func (*State) IsUserdata

func (L *State) IsUserdata(index int) bool

func (*State) LessThan

func (L *State) LessThan(index1, index2 int) bool

func (*State) Load

func (L *State) Load(reader Reader, data interface{}, chunkname string) int

func (*State) LoadFile

func (L *State) LoadFile(filename string) int

func (*State) LoadString

func (L *State) LoadString(s string) int

func (*State) NewMetaTable

func (L *State) NewMetaTable(tname string) bool

returns false if registry already contains key tname

func (*State) NewTable

func (L *State) NewTable()

func (*State) NewThread

func (L *State) NewThread() *State

func (*State) NewUserdata

func (L *State) NewUserdata(size uintptr) unsafe.Pointer

old style

func (*State) Next

func (L *State) Next(index int) int

func (*State) ObjLen

func (L *State) ObjLen(index int) uint

func (*State) OpenBase

func (L *State) OpenBase()

func (*State) OpenIO

func (L *State) OpenIO()

func (*State) OpenLibs

func (L *State) OpenLibs()

func (*State) OpenMath

func (L *State) OpenMath()

func (*State) OpenOS

func (L *State) OpenOS()

func (*State) OpenPackage

func (L *State) OpenPackage()

func (*State) OpenString

func (L *State) OpenString()

func (*State) OpenTable

func (L *State) OpenTable()

func (*State) OptInteger

func (L *State) OptInteger(narg int, d int) int

func (*State) OptNumber

func (L *State) OptNumber(narg int, d float64) float64

func (*State) OptString

func (L *State) OptString(narg int, d string) string

func (*State) PCall

func (L *State) PCall(nargs int, nresults int, errfunc int) int

func (*State) Pop

func (L *State) Pop(n int)

func (*State) PushBoolean

func (L *State) PushBoolean(b bool)

func (*State) PushGoFunction

func (L *State) PushGoFunction(f GoFunction)

func (*State) PushInteger

func (L *State) PushInteger(n int)

func (*State) PushLightInteger

func (L *State) PushLightInteger(n int)

func (*State) PushLightUserdata

func (L *State) PushLightUserdata(ud *interface{})

push pointer by value, as a value - we don't impact lifetime

func (*State) PushNil

func (L *State) PushNil()

func (*State) PushNumber

func (L *State) PushNumber(n float64)

func (*State) PushString

func (L *State) PushString(str string)

func (*State) PushThread

func (L *State) PushThread() (isMain bool)

func (*State) PushValue

func (L *State) PushValue(index int)

func (*State) RawEqual

func (L *State) RawEqual(index1 int, index2 int) bool

func (*State) RawGet

func (L *State) RawGet(index int)

func (*State) RawGeti

func (L *State) RawGeti(index int, n int)

func (*State) RawSet

func (L *State) RawSet(index int)

func (*State) RawSeti

func (L *State) RawSeti(index int, n int)

func (*State) Ref

func (L *State) Ref(t int) int

func (*State) Register

func (L *State) Register(name string, f GoFunction)

func (*State) Remove

func (L *State) Remove(index int)

func (*State) Replace

func (L *State) Replace(index int)

func (*State) Resume

func (L *State) Resume(narg int) int

func (*State) SetAllocf

func (L *State) SetAllocf(f Alloc)

func (*State) SetExecutionLimit

func (L *State) SetExecutionLimit(instrNumber int)

func (*State) SetField

func (L *State) SetField(index int, k string)

func (*State) SetGlobal

func (L *State) SetGlobal(name string)

func (*State) SetMetaTable

func (L *State) SetMetaTable(index int)

func (*State) SetTable

func (L *State) SetTable(index int)

func (*State) SetTop

func (L *State) SetTop(index int)

func (*State) SetfEnv

func (L *State) SetfEnv(index int)

func (*State) Status

func (L *State) Status() int

func (*State) ToBoolean

func (L *State) ToBoolean(index int) bool

func (*State) ToGoFunction

func (L *State) ToGoFunction(index int) (f GoFunction)

func (*State) ToInteger

func (L *State) ToInteger(index int) int

func (*State) ToLightInteger

func (L *State) ToLightInteger(index int) int

func (*State) ToNumber

func (L *State) ToNumber(index int) float64

func (*State) ToPointer

func (L *State) ToPointer(index int) uintptr

func (*State) ToString

func (L *State) ToString(index int) string

func (*State) ToThread

func (L *State) ToThread(index int) *State

func (*State) ToUserdata

func (L *State) ToUserdata(index int) unsafe.Pointer

func (*State) Type

func (L *State) Type(index int) int

func (*State) Typename

func (L *State) Typename(tp int) string

func (*State) Yield

func (L *State) Yield(nresults int) int

type Writer

type Writer func(L *State, p []byte, ud interface{})

like lua_Writer, but as p will contain capacity, not needed as separate param

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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