luar.go
func Register(L *lua.State, table string, values Map) {
	pop := true
	if table == "*" {
		pop = false
	} else if len(table) > 0 {
		L.GetGlobal(table)
		if L.IsNil(-1) {
			L.Pop(1)
			L.NewTable()
			L.SetGlobal(table)
			L.GetGlobal(table)
		}
	} else {
		L.GetGlobal("_G")
	}
	for name, val := range values {
		GoToLuaProxy(L, val)
		L.SetField(-2, name)
	}
	if pop {
		L.Pop(1)
	}
}
func Register(L *lua.State, table string, values Map) {
	pop := true
	if table == "*" {
		pop = false
	} else if len(table) > 0 {
		L.GetGlobal(table)
		if L.IsNil(-1) {
			L.Pop(1)
			L.NewTable()
			L.SetGlobal(table)
			L.GetGlobal(table)
		}
	} else {
		L.GetGlobal("_G")
	}
	for name, val := range values {
		GoToLuaProxy(L, val)
		L.SetField(-2, name)
	}
	if pop {
		L.Pop(1)
	}
}
func Register ( L * lua . State , table string , values Map ) { pop := true if table == " " { pop = false } else if len ( table ) > 0 { L . GetGlobal ( table ) if L . IsNil ( - 1 ) { L . Pop ( 1 ) L . NewTable ( ) L . SetGlobal ( table ) L . GetGlobal ( table ) } } else { L . GetGlobal ( " " ) } for name , val := range values { GoToLuaProxy ( L , val ) L . SetField ( - 2 , name ) } if pop { L . Pop ( 1 ) } }
// Register makes a number of Go values available in Lua code as proxies.
// 'values' is a map of strings to Go values.
//
// - If table is non-nil, then create or reuse a global table of that name and
// put the values in it.
//
// - If table is '' then put the values in the global table (_G).
//
// - If table is '*' then assume that the table is already on the stack.
//
// See GoToLuaProxy's documentation.
Register makes a number of Go values available in Lua code as proxies . values is a map of strings to Go values . - If table is non - nil then create or reuse a global table of that name and put the values in it . - If table is then put the values in the global table ( _G ) . - If table is * then assume that the table is already on the stack . See GoToLuaProxy s documentation .