Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
DataGrid
DescriptionA datagrid datastructureFunctions
delete
DescriptionDeletes data gridDefinition
delete()Code
35 | function DataGrid:delete() |
36 | self.grid = nil |
37 | end |
getValue
Description@param integer colIndex index of columnDefinition
getValue()Return Values
table | value | value at the given position |
44 | function DataGrid:getValue(rowIndex, colIndex) |
45 | if rowIndex < 1 or rowIndex > self.numRows then |
46 | Logging.error("rowIndex out of bounds!") |
47 | printCallstack() |
48 | return nil |
49 | end |
50 | if colIndex < 1 or colIndex > self.numColumns then |
51 | Logging.error("colIndex out of bounds!") |
52 | printCallstack() |
53 | return nil |
54 | end |
55 | |
56 | return self.grid[rowIndex][colIndex] |
57 | end |
new
DescriptionCreating data gridDefinition
new(integer numRows, integer numColumns, table customMt)Arguments
integer | numRows | number of rows |
integer | numColumns | number of columns |
table | customMt | custom metatable |
table | instance | instance of object |
19 | function DataGrid.new(numRows, numColumns, customMt) |
20 | local self = {} |
21 | setmetatable(self, customMt or DataGrid_mt) |
22 | |
23 | self.grid = {} |
24 | self.numRows = numRows |
25 | self.numColumns = numColumns |
26 | for _=1, numRows do |
27 | table.insert(self.grid, {}) |
28 | end |
29 | |
30 | return self |
31 | end |
setValue
Description@param integer colIndex index of columnDefinition
setValue(table value)Arguments
table | value | value at the given position |
64 | function DataGrid:setValue(rowIndex, colIndex, value) |
65 | if rowIndex < 1 or rowIndex > self.numRows then |
66 | Logging.error("rowIndex out of bounds!") |
67 | printCallstack() |
68 | return false |
69 | end |
70 | if colIndex < 1 or colIndex > self.numColumns then |
71 | Logging.error("colIndex out of bounds!") |
72 | printCallstack() |
73 | return false |
74 | end |
75 | |
76 | self.grid[rowIndex][colIndex] = value |
77 | return true |
78 | end |