FCALL

Invokes a function registered in a loaded library.

Lua & functions · Example verified

Syntax covered here

FCALL function numkeys key

The case loads a Lua function marked no-writes and reads one declared key; it does not exercise a writing function.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> FUNCTION FLUSH
"OK"
# connection: default
> FUNCTION LOAD "#!lua name=manual\nredis.register_function{function_name='read_value', callback=function(keys,args) return redis.call('GET',keys[1]) end, flags={'no-writes'}}"
"manual"
# connection: default
> SET sample value
"OK"
# connection: default
> fcall read_value 1 sample
"value"