summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2010-01-12 12:09:46 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2010-01-12 13:35:39 +1000
commitacabbaacbc91db8c6b711b85e1f68694b42ed829 (patch)
tree63053744baefd88d2d5b2d7d002234f6571f20c3 /crawl-ref/source/dat
parentaf50b39780da6717f5f9a597a66c0c97e01329e5 (diff)
downloadcrawl-ref-acabbaacbc91db8c6b711b85e1f68694b42ed829.tar.gz
crawl-ref-acabbaacbc91db8c6b711b85e1f68694b42ed829.zip
Some new Lua wrappers for dungeon building and ranges.
Introduces util.range(start, stop), returning an array consisting of the numeric values between start and stop inclusive. Also introduces "is_valid_coord" Lua wrapper, which does the same work as _valid_coord but does not generate an error message for invalid coordinates, "find_in_area" (a straight translation of the function in dungeon.cc), and "is_passable_coord" which checks the glyph at that location against traversable_glyphs.
Diffstat (limited to 'crawl-ref/source/dat')
-rw-r--r--crawl-ref/source/dat/clua/util.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/crawl-ref/source/dat/clua/util.lua b/crawl-ref/source/dat/clua/util.lua
index 8dd0b35eba..ffc8e8c3ae 100644
--- a/crawl-ref/source/dat/clua/util.lua
+++ b/crawl-ref/source/dat/clua/util.lua
@@ -242,6 +242,14 @@ function util.expand_entity(entity, msg)
end)
end
+function util.range(start, stop)
+ local rt
+ for i = start, stop do
+ table.insert(rt, i)
+ end
+ return rt
+end
+
----------------------------------------------------------
util.Timer = { CLASS = "Timer" }
@@ -337,4 +345,4 @@ function util.namespace(table_name)
if _G[table_name] == nil then
_G[table_name] = { }
end
-end \ No newline at end of file
+end