Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoToLuaValue ¶
func GoToLuaValue(L *lua.LState, value any) lua.LValue
GoToLuaValue converts a Go value to a corresponding Lua value suitable for Lua state operations.
func LuaValue ¶
LuaValue converts a Lua value to its corresponding Go type. It takes a lua.LValue as input and returns the converted value and an error. The function supports converting Lua strings to Go strings, Lua numbers to Go float64, Lua booleans to Go bool, and Lua nil to Go nil. If the Lua value is of any other type, it returns an error.
func LuaValueToGo ¶ added in v1.3.0
func LuaValueToGo(value lua.LValue) any
LuaValueToGo converts a lua.LValue to a corresponding Go value (nil, bool, float64, string, or map).
func StringCmd ¶
StringCmd attempts to convert a given *redis.StringCmd value into the specified type.
Parameters: value: The redis.StringCmd value to be converted. valType: The type that the redis.StringCmd should be converted to. Acceptable values include:
- "string": converts the redis.StringCmd to a Lua string.
- "number": converts the redis.StringCmd to a Lua number. If the conversion fails, it returns an error.
- "boolean": converts the redis.StringCmd to a Lua boolean. If the conversion fails, it returns an error.
L: The Lua state against which these conversions are made. This method pushes the converted value onto the L lua.LState if the conversion is successful.
It returns nil if the conversion is successful. It returns an error if the conversion fails or if the conversion is attempted on an unsupported type.
Example usage:
err := convertStringCmd(myStringCmd, "number", myLuaState) if err != nil { log.Fatal(err) }
Types ¶
This section is empty.