Radiator Server Documentation — v10.33.2

Lua script context API - Variables sub-context

Table of Contents
  • vars
  • Methods
  • Example

vars

Custom variables for passing data between pipeline actions.

Methods

MethodParametersReturnsDescription
get(name)variable namevalue?Get first value
get_all(name)variable namevalues?Get all values
set(name, value)name, value-Set variable (replaces existing)
append(name, value)name, value-Append to variable
remove(name)variable namevalues?Remove and return values

Example

local context, previous = ...

local vars = context.vars

-- Store computed value
vars:set("custom.session_key", "abc123")

-- Retrieve later
local key = vars:get("custom.session_key")

-- Append multiple values
vars:append("custom.tags", "tag1")
vars:append("custom.tags", "tag2")
local all_tags = vars:get_all("custom.tags")

return previous
Table of Contents
Navigation
  • @verification

  • aaa

  • backends

  • caches

  • captures

  • certificates

  • clients

  • conditions

  • dictionary

  • hmac-otp

  • include

  • init

  • ip-accept

  • license

  • logging

  • management

  • proxy-protocol

  • scripts

    • context

      • aaa

      • acct

      • auth

      • cache

      • cert

      • eap

      • eap_teap

      • eap_ttls

      • http

      • radius

      • radiusproxy

      • stats

      • tls

      • user

      • vars

  • servers

  • statistics

  • stats

  • template

  • ui