9/26/08

Local Variables

Introduction

Variables, as I said in my tutorials, have two kinds, a global and a local variable.

And yes, you can guess it there difference by there name. Global variables will retain it's value after the script, while the local variables will be nil after the script.

Usage and Declaration


local variables are declared by adding "local" before the variable declaration

/run local x=1


to declare more than one local, instead declare them by commas

/run local x,y=1,2


DO NOT USE LONG CHARACTERS FOR LOCAL VARIABLES.
ONE CHARACTER VARIABLES IS THE BEST.

so instead of using

/run local targethp=UnitHealth("target")

use

/run local h=UnitHealth("target")


No comments: