View Single Post
03-11-13, 03:22 AM   #18
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
I memorized it this way: "do ... end" is a new scope. for, while, etc expand on it.
If your code have variables or functions that run only once during runtime you can put them in a new scope so that they can be removed from memory during the "normal" runtime of your code.

Lua Code:
  1. local setting
  2. do
  3.     local result = false
  4.     local function check()
  5.         return true
  6.     end
  7.     result = check()
  8.     setting = result
  9. end
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote