MCPcopy Create free account
hub / github.com/crawl/crawl / crawl_get_command

Function crawl_get_command

crawl-ref/source/l-crawl.cc:1291–1307  ·  view source on GitHub ↗

Look up the current key bound to a command. * @tparam string name Name as in cmd-name.h * @treturn string|nil * @function get_command */

Source from the content-addressed store, hash-verified

1289 * @function get_command
1290 */
1291static int crawl_get_command(lua_State *ls)
1292{
1293 if (lua_gettop(ls) == 0)
1294 {
1295 lua_pushnil(ls);
1296 return 1;
1297 }
1298
1299 const command_type cmd = name_to_command(luaL_checkstring(ls, 1));
1300
1301 string cmd_name = command_to_string(cmd, true);
1302 if (strcmp(cmd_name.c_str(), "<") == 0)
1303 cmd_name = "<<";
1304
1305 lua_pushstring(ls, cmd_name.c_str());
1306 return 1;
1307}
1308
1309LUAWRAP(crawl_tutorial_skill, set_tutorial_skill(luaL_checkstring(ls, 1), luaL_safe_checkint(ls, 2)))
1310LUAWRAP(crawl_tutorial_hint, tutorial_init_hint(luaL_checkstring(ls, 1)))

Callers

nothing calls this directly

Calls 2

name_to_commandFunction · 0.85
command_to_stringFunction · 0.85

Tested by

no test coverage detected