luar.go
func Init() *lua.State {
	var L = lua.NewState()
	L.OpenLibs()
	Register(L, "luar", Map{
		// Functions.
		"unproxify": Unproxify,

		"method": ProxyMethod,

		"chan":    MakeChan,
		"complex": Complex,
		"map":     MakeMap,
		"slice":   MakeSlice,

		// Values.
		"null": Null,
	})
	Register(L, "", Map{
		"pairs": ProxyPairs,
		"type":  ProxyType,
	})
	// 'ipairs' needs a special case for performance reasons.
	RegProxyIpairs(L, "", "ipairs")
	return L
}
func Init() *lua.State {
	var L = lua.NewState()
	L.OpenLibs()
	Register(L, "luar", Map{
		// Functions.
		"unproxify": Unproxify,

		"method": ProxyMethod,

		"chan":    MakeChan,
		"complex": Complex,
		"map":     MakeMap,
		"slice":   MakeSlice,

		// Values.
		"null": Null,
	})
	Register(L, "", Map{
		"pairs": ProxyPairs,
		"type":  ProxyType,
	})
	// 'ipairs' needs a special case for performance reasons.
	RegProxyIpairs(L, "", "ipairs")
	return L
}
func Init ( ) * lua . State { var L = lua . NewState ( ) L . OpenLibs ( ) Register ( L , " " , Map { // Functions. " " : Unproxify , " " : ProxyMethod , " " : MakeChan , " " : Complex , " " : MakeMap , " " : MakeSlice , // Values. " " : Null , } ) Register ( L , " " , Map { " " : ProxyPairs , " " : ProxyType , } ) // 'ipairs' needs a special case for performance reasons. RegProxyIpairs ( L , " " , " " ) return L }
// Init makes and initializes a new pre-configured Lua state.
//
// It populates the 'luar' table with some helper functions/values:
//
//   method: ProxyMethod
//   unproxify: Unproxify
//
//   chan: MakeChan
//   complex: MakeComplex
//   map: MakeMap
//   slice: MakeSlice
//
//   null: Null
//
// It replaces the 'pairs'/'ipairs' functions with ProxyPairs/ProxyIpairs
// respectively, so that __pairs/__ipairs can be used, Lua 5.2 style. It allows
// for looping over Go composite types and strings.
//
// It also replaces the 'type' function with ProxyType.
//
// It is not required for using the 'GoToLua' and 'LuaToGo' functions.
Init makes and initializes a new pre - configured Lua state . It populates the luar table with some helper functions / values : method : ProxyMethod unproxify : Unproxify chan : MakeChan complex : MakeComplex map : MakeMap slice : MakeSlice null : Null It replaces the pairs / ipairs functions with ProxyPairs / ProxyIpairs respectively so that __pairs / __ipairs can be used Lua 5 . 2 style . It allows for looping over Go composite types and strings . It also replaces the type function with ProxyType . It is not required for using the GoToLua and LuaToGo functions .