lua:scripting:examples:olcgrid
Differences
This shows you the differences between two versions of the page.
| lua:scripting:examples:olcgrid [2015/01/01 08:35] – created vodur | lua:scripting:examples:olcgrid [2026/10/16 00:30] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | In luai | ||
| - | <code lua> | ||
| - | 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(" | ||
| - | end | ||
| - | end | ||
| - | |||
| - | for col=1,cols do | ||
| - | for row=1,rows do | ||
| - | local vnum=getvnum(col, | ||
| - | mdo(" | ||
| - | if not(row==1) then -- do north stuff | ||
| - | olc(" | ||
| - | end | ||
| - | if not(row==rows) then -- do south stuff | ||
| - | olc(" | ||
| - | end | ||
| - | if not(col==1) then -- do west stuff | ||
| - | olc(" | ||
| - | end | ||
| - | if not(col==cols) then -- do east stuff | ||
| - | olc(" | ||
| - | end | ||
| - | end | ||
| - | end | ||
| - | |||
| - | end | ||
| - | </ | ||
