Difference between revisions of "LUA:GetVariableValue"

(Created page with "= LUA Functions: GetVariableValue() = Gets the value of the given variable ==== Syntax ==== var = GetVariableValue(param1) ==== Parameters ==== ; Required - ''param1'' (strin...")
 
(Notes)
 
Line 24: Line 24:
 
Returns a string
 
Returns a string
  
This gets the values for variables in the `variables` table
+
This gets the values for variables in the `variables` table.
 +
 
 +
Also, if you want to return values set by [[LUA:SetServerVariable|SetServerVariable()]], make sure to include the 'lua_' prefix, slightly different from [[LUA:GetServerVariable|GetServerVariable()]].

Latest revision as of 19:33, 8 August 2016

LUA Functions: GetVariableValue()

Gets the value of the given variable


Syntax

var = GetVariableValue(param1)


Parameters

Required - param1 (string)
param1 is the name of the variable


Usage

function hailed(NPC, Spawn)
    Say(NPC, "Level cap is set to " .. GetVariableValue("level_cap"))
end

The NPC will respond with the level cap for the server

Notes

Returns a string

This gets the values for variables in the `variables` table.

Also, if you want to return values set by SetServerVariable(), make sure to include the 'lua_' prefix, slightly different from GetServerVariable().