github.com/dfcfw/lua@v0.0.0-20230325031207-0cc7ffb7b8b9/luar/doc.go (about) 1 // Package luar simplifies data passing to and from gopher-lua. 2 // (https://github.com/yuin/gopher-lua). 3 // 4 // # Go to Lua conversions 5 // 6 // See documentation of New function. 7 // 8 // # Lua to Go conversions 9 // 10 // Lua types are automatically converted to match the output Go type (e.g. 11 // setting a struct field from Lua). 12 // 13 // lua.LNil can be converted to any channel, func, interface, map, pointer, 14 // slice, unsafepointer, or uintptr value. 15 // 16 // lua.LBool values are converted to bool. 17 // 18 // lua.LNumber values are converted to float64. 19 // 20 // lua.LString values are converted to string. 21 // 22 // lua.LChannel values are converted to lua.LChannel. 23 // 24 // *lua.LTable values can be converted to an array, slice, map, struct, or 25 // struct pointer. If the table is being assigned with no type information (i.e. 26 // to an interface{}), the converted value will have the type 27 // map[interface{}]interface{}. 28 // 29 // The Value field of *lua.LUserData values are converted rather than the 30 // *lua.LUserData value itself. 31 // 32 // *lua.LState values are converted to *lua.LState. 33 // 34 // *lua.LFunction values are converted to Go functions. If the function is 35 // being assigned with no type information (i.e. to a interface{}), the function 36 // will have the signature func(...interface{}) []interface{}. The arguments 37 // and return values will be converted using the standard luar conversion rules. 38 // 39 // # Thread safety 40 // 41 // This package accesses and modifies the Lua state's registry. This happens 42 // when functions like New are called, and potentially when luar-created values 43 // are used. It is your responsibility to ensure that concurrent access of the 44 // state's registry does not happen. 45 package luar // import "layeh.com/gopher-luar"