diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-20 16:17:27 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-20 16:17:27 +0200 |
commit | 32e9f18033d30051e3a93414010cd234d6915abd (patch) | |
tree | 51da9d4885b52f2288c1fcad57bc0adfbf7a5301 | |
parent | 7c97899cefb5ed1dd3547b9800f96b5a4cb24bf6 (diff) | |
download | crawl-ref-32e9f18033d30051e3a93414010cd234d6915abd.tar.gz crawl-ref-32e9f18033d30051e3a93414010cd234d6915abd.zip |
Change you_dlib load style.
-rw-r--r-- | crawl-ref/source/dlua.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/l_libs.h | 3 | ||||
-rw-r--r-- | crawl-ref/source/l_you.cc | 11 |
3 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/dlua.cc b/crawl-ref/source/dlua.cc index 27898f1b81..fa94dd8780 100644 --- a/crawl-ref/source/dlua.cc +++ b/crawl-ref/source/dlua.cc @@ -307,6 +307,7 @@ void init_dungeon_lua() lua_stack_cleaner clean(dlua); dluaopen_crawl(dlua); + dluaopen_you(dlua); luaL_openlib(dlua, "dgn", dgn_dlib, 0); luaL_openlib(dlua, "dgn", dgn_build_dlib, 0); @@ -319,7 +320,6 @@ void init_dungeon_lua() luaL_openlib(dlua, "debug", debug_dlib, 0); luaL_openlib(dlua, "file", file_dlib, 0); - luaL_openlib(dlua, "you", you_dlib, 0); luaL_openlib(dlua, "los", los_dlib, 0); dlua.execfile("clua/dungeon.lua", true, true); diff --git a/crawl-ref/source/l_libs.h b/crawl-ref/source/l_libs.h index 663b378832..191b6cb531 100644 --- a/crawl-ref/source/l_libs.h +++ b/crawl-ref/source/l_libs.h @@ -31,7 +31,6 @@ extern const struct luaL_reg dgn_tile_dlib[]; extern const struct luaL_reg file_dlib[]; extern const struct luaL_reg los_dlib[]; extern const struct luaL_reg mapmarker_dlib[]; -extern const struct luaL_reg you_dlib[]; void luaopen_dgnevent(lua_State *ls); void luaopen_mapmarker(lua_State *ls); @@ -42,7 +41,7 @@ void register_itemlist(lua_State *ls); void register_builder_funcs(lua_State *ls); void dluaopen_crawl(lua_State *ls); - +void dluaopen_you(lua_State *ls); /* * Macros for processing object arguments. */ diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc index 95149cb772..236b98b41b 100644 --- a/crawl-ref/source/l_you.cc +++ b/crawl-ref/source/l_you.cc @@ -12,10 +12,6 @@ LUARET1(you_x_pos, number, you.pos().x) LUARET1(you_y_pos, number, you.pos().y) LUARET2(you_pos, number, you.pos().x, you.pos().y) -// see_cell should not be exposed to user scripts. The game should -// never disclose grid coordinates to the player. Therefore we load it -// only into the core Lua interpreter (dlua), never into the user -// script interpreter (clua). LUARET1(you_see_cell, boolean, see_cell(luaL_checkint(ls, 1), luaL_checkint(ls, 2))) LUARET1(you_see_cell_no_trans, boolean, @@ -41,7 +37,7 @@ LUAFN(you_losight) return (0); } -const struct luaL_reg you_dlib[] = +static const struct luaL_reg you_dlib[] = { { "hear_pos", you_can_hear_pos }, { "x_pos", you_x_pos }, @@ -54,3 +50,8 @@ const struct luaL_reg you_dlib[] = { "losight", you_losight }, { NULL, NULL } }; + +void dluaopen_you(lua_State *ls) +{ + luaL_openlib(ls, "you", you_dlib, 0); +} |