Пример #1
0
Файл: lua.go Проект: szll/golua
// Returns the value at index as a Go function (it must be something pushed with PushGoFunction)
func (L *State) ToGoFunction(index int) (f LuaGoFunction) {
	if !L.IsGoFunction(index) {
		return nil
	}
	fid := C.clua_togofunction(L.s, C.int(index))
	if fid < 0 {
		return nil
	}
	return L.registry[fid].(LuaGoFunction)
}
Пример #2
0
func (L *State) ToGoFunction(index int) (f GoFunction) {
	fid := C.clua_togofunction(L.s, C.int(index))
	return L.registry[fid].(GoFunction)
}