data.setCell
Description
Set a cell string value within a 2D array (grid) returned from data.loadCsvFile or data.runSelectQuery etc.

Parameters
grid 2D array (in format cells[yRow][xCol])
xCol integer (one-based X/column index)
yRow integer (one-based Y/row index)
value string

Return value
none

Example
-- load cells from CSV
local cells = data.loadCsvFile(io.getSpecialFolderPath(CSIDL_MYDOCUMENTS) .. "test.csv")

-- set value in cell 2,1
data.setCell(cells, 2, 1, "Hello")

-- print cell 2,1
local value = data.getCell(cells, 2, 1)
print(value)

Comments
If the x,y values are outside of the range of the array then the array is resized automatically and padded with empty strings.

See also
data.getCell
data.printCell

Back
Generated on the 26 June 2024 at 22:01:28 (UK Time)