From b2fde0cf32348355f7725c6a7b0a523e0958c1a4 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 3 Mar 2012 20:34:57 +0100 Subject: Made some global Lua variables local We have to be careful with introducing globals now that there is only a single Lua state, so we shouldn't use globals unnecessarily. Any variable should be declared 'local' unless there is a reason to make it global. For additional safety we can also think about disallowing the use of globals entirely. This also helps to catch typos in scripts. Reviewed-by: Erik Schilling --- example/scripts/special_actions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'example/scripts/special_actions.lua') diff --git a/example/scripts/special_actions.lua b/example/scripts/special_actions.lua index 711478f2..7e42ad43 100644 --- a/example/scripts/special_actions.lua +++ b/example/scripts/special_actions.lua @@ -13,7 +13,7 @@ specialCost[1] = 50 specialCost[2] = 250 specialCost[3] = 1000 -function use_special(ch, id) +local function use_special(ch, id) -- perform whatever the special with the ID does if id == 1 then mana.being_say(ch, "Kaaame...Haaame... HAAAAAA!") @@ -26,7 +26,7 @@ function use_special(ch, id) end end -function get_special_recharge_cost(id) +local function get_special_recharge_cost(id) -- return the recharge cost for the special with the ID return specialCost[id] end -- cgit v1.2.3-60-g2f50