summaryrefslogtreecommitdiff
path: root/example/scripts/special_actions.lua
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-03 20:34:57 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-03 21:24:45 +0100
commitb2fde0cf32348355f7725c6a7b0a523e0958c1a4 (patch)
treef12ab2fff979db589bc5a4a6de6fc7e8b4d67313 /example/scripts/special_actions.lua
parent84c87cc99be29a694f0ffe83ab7a06ae433bb0cd (diff)
downloadmanaserv-b2fde0cf32348355f7725c6a7b0a523e0958c1a4.tar.gz
manaserv-b2fde0cf32348355f7725c6a7b0a523e0958c1a4.tar.bz2
manaserv-b2fde0cf32348355f7725c6a7b0a523e0958c1a4.tar.xz
manaserv-b2fde0cf32348355f7725c6a7b0a523e0958c1a4.zip
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
Diffstat (limited to 'example/scripts/special_actions.lua')
-rw-r--r--example/scripts/special_actions.lua4
1 files changed, 2 insertions, 2 deletions
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