MCPcopy Create free account
hub / github.com/NetHack/NetHack / nhl_int_to_pm_name

Function nhl_int_to_pm_name

src/nhlua.c:1172–1187  ·  view source on GitHub ↗

return gender-neutral monster type name by integer value, or empty string if outside LOW_PM - HIGH_PM range */ local montypename = int_to_pmname(12); */

Source from the content-addressed store, hash-verified

1170 or empty string if outside LOW_PM - HIGH_PM range */
1171/* local montypename = int_to_pmname(12); */
1172staticfn int
1173nhl_int_to_pm_name(lua_State *L)
1174{
1175 int argc = lua_gettop(L);
1176
1177 if (argc == 1) {
1178 lua_Integer i = luaL_checkinteger(L, 1);
1179
1180 if (i >= LOW_PM && i <= HIGH_PM)
1181 lua_pushstring(L, mons[i].pmnames[NEUTRAL]);
1182 else
1183 lua_pushstring(L, "");
1184 } else
1185 nhl_error(L, "Expected an integer parameter");
1186 return 1;
1187}
1188
1189/* convert integer to object type name and class */
1190/* local oname,oclass = int_to_objname(25); */

Callers

nothing calls this directly

Calls 1

nhl_errorFunction · 0.85

Tested by

no test coverage detected