View Single Post
08-18-12, 05:59 AM   #8
Jarod24
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2012
Posts: 66
Um. 2 more questions...

Things like string.len() and strlen() are as far as i know the same thing, but why do they both exist?

Is it just legacy from ealier Lua versions (pre 5.1) or are they maybe Blizzard implemented shortcuts/wrappers?


When it comes to referring to functions in tables.
Code:
--is this better?
local math_abs = math.abs;
local math_floor = math.floor;

--would just referring to 'math' itself be good enough?
local math = math;
Am i correct in thinking that using an math_abs approach would be better? In my head, that would refer directly to the function in question, saving you the _G lookup and then the math[] table-lookup aswell.

Last edited by Jarod24 : 08-18-12 at 06:17 AM.
  Reply With Quote