diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-28 12:04:38 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-06-28 12:04:38 +0000 |
commit | d1968a5ba426ba5d202ff2824115b568de3f5f3f (patch) | |
tree | 04495c853b89bb901659bf1959b97ae835e79816 /crawl-ref/source/clua.cc | |
parent | 26f8579e71cadfe6d757a1a8c979a51eba6305df (diff) | |
download | crawl-ref-d1968a5ba426ba5d202ff2824115b568de3f5f3f.tar.gz crawl-ref-d1968a5ba426ba5d202ff2824115b568de3f5f3f.zip |
Updated level-design.txt with a basic overview of the Lua possibilities.
Fixed some inconsistencies in the handling of Lua errors.
Tweaked the lexer to allow spaces before Lua chunk prefixes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1676 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/clua.cc')
-rw-r--r-- | crawl-ref/source/clua.cc | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index 33047c504e..5448ca6d68 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -717,6 +717,9 @@ LUARET1(you_flying, boolean, player_is_levitating() && wearing_amulet(AMU_CONTROLLED_FLIGHT)) LUARET1(you_transform, string, transform_name()) LUARET1(you_where, string, level_id::current().describe().c_str()) +LUARET1(you_branch, string, level_id::current().describe(false, false).c_str()) +LUARET1(you_subdepth, number, level_id::current().depth) +LUARET1(you_absdepth, number, you.your_level) LUAWRAP(you_stop_activity, interrupt_activity(AI_FORCE_INTERRUPT)) void lua_push_floor_items(lua_State *ls); @@ -770,8 +773,8 @@ static const struct luaL_reg you_lib[] = { "strength" , you_strength }, { "intelligence", you_intelligence }, { "dexterity" , you_dexterity }, - { "exp" , you_exp }, - { "exp_points" , you_exp_points }, + { "xl" , you_exp }, + { "exp" , you_exp_points }, { "res_poison" , you_res_poison }, { "res_fire" , you_res_fire }, @@ -790,7 +793,10 @@ static const struct luaL_reg you_lib[] = { "floor_items", you_floor_items }, - { "where", you_where }, + { "where", you_where }, + { "branch", you_branch }, + { "subdepth", you_subdepth }, + { "absdepth", you_absdepth }, { NULL, NULL }, }; @@ -1543,14 +1549,19 @@ static int crawl_mpr(lua_State *ls) return (0); int ch = MSGCH_PLAIN; - const char *channel = lua_tostring(ls, 2); - if (channel) - ch = str_to_channel(channel); - if (ch == -1) + if (lua_isnumber(ls, 2)) + ch = luaL_checkint(ls, 2); + else + { + const char *channel = lua_tostring(ls, 2); + if (channel) + ch = str_to_channel(channel); + } + + if (ch < 0 || ch >= NUM_MESSAGE_CHANNELS) ch = MSGCH_PLAIN; mpr(message, ch); - return (0); } |