View Single Post
10-15-05, 11:15 AM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
You can send local values to a function with the paremeters.

local function rollCompare(i,j)
return rollTable[i] < rollTable[j];
end

In the above example, i and j are send to the function: local val = rollCompare(3,5) is the same as:

i=3
j=5
local val = rollCompare() with the example below

local function rollCompare()
return rollTable[i] < rollTable[j];
end

It's a lot tidier to keep stuff in parameters. They're local and put on the stack so won't create garbage to collect.
  Reply With Quote