In luai
do local cols=5 local rows=5 local basevnum=501 local function getvnum( col, row) return basevnum-1 + (row-1)*cols + col end for col=1,cols do for row=1,rows do mdo("redit create "..getvnum(col,row) ) end end for col=1,cols do for row=1,rows do local vnum=getvnum(col,row) mdo("goto "..vnum) if not(row==1) then -- do north stuff olc("north dig "..getvnum(col,row-1)) end if not(row==rows) then -- do south stuff olc("south dig "..getvnum(col,row+1)) end if not(col==1) then -- do west stuff olc("west dig "..getvnum(col-1,row)) end if not(col==cols) then -- do east stuff olc("east dig "..getvnum(col+1,row)) end end end end