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

Function l_selection_line

src/nhlsel.c:508–527  ·  view source on GitHub ↗

local s = selection.line(sel, x1,y1, x2,y2); */ local s = selection.line(x1,y1, x2,y2); */ s:line(x1,y1, x2,y2); */

Source from the content-addressed store, hash-verified

506/* local s = selection.line(x1,y1, x2,y2); */
507/* s:line(x1,y1, x2,y2); */
508staticfn int
509l_selection_line(lua_State *L)
510{
511 struct selectionvar *sel = NULL;
512 coordxy x1, y1, x2, y2;
513
514 if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) {
515 nhl_error(L, "selection.line: illegal arguments");
516 }
517
518 get_location_coord(&x1, &y1, ANY_LOC, gc.coder ? gc.coder->croom : NULL,
519 SP_COORD_PACK(x1, y1));
520 get_location_coord(&x2, &y2, ANY_LOC, gc.coder ? gc.coder->croom : NULL,
521 SP_COORD_PACK(x2, y2));
522
523 (void) l_selection_clone(L);
524 sel = l_selection_check(L, 2);
525 selection_do_line(x1,y1,x2,y2, sel);
526 return 1;
527}
528
529/* local s = selection.rect(sel, x1,y1, x2,y2); */
530staticfn int

Callers

nothing calls this directly

Calls 6

params_sel_2coordsFunction · 0.85
nhl_errorFunction · 0.85
get_location_coordFunction · 0.85
l_selection_cloneFunction · 0.85
l_selection_checkFunction · 0.85
selection_do_lineFunction · 0.85

Tested by

no test coverage detected