[READ-ONLY] Mirror of https://github.com/thoda-dev/du-lua-cheatsheet. a simple cheatsheet for lua in Dual Universe
dual-universe lua
0

Configure Feed

Select the types of activity you want to include in your feed.

Update README.md

Thomas (Jan 23, 2023, 7:50 PM +0100) 5de1b686 a9729ab9

+9 -9
+9 -9
README.md
··· 61 61 62 62 63 63 -- API functions 64 - table.foreach(t, function(row) ... end) -- Iterates over the table 65 - table.setn(t, 10) -- Sets the length of the table 66 - table.insert(t, 21) -- append (--> t[#t+1] = 21) 67 - table.insert(t, 4, 99) -- insert (--> t[4] = 99) 68 - table.getn(t) -- length (--> #t) 69 - table.concat(t, ", ") -- join (--> "a, b, c, d") 70 - table.sort(t) -- sort (--> { "a", "b", "c", "d" } 71 - table.sort(t, function(a,b) return a > b end) -- sort (--> { "d", "c", "b", "a" } 72 - table.remove(t, 4) -- remove (--> "d") 64 + table.foreach(t, function(row) --[[do something for one row]] end) -- Iterates over the table 65 + table.setn(t, 10) -- Sets the length of the table 66 + table.insert(t, 21) -- append (--> t[#t+1] = 21) 67 + table.insert(t, 4, 99) -- insert (--> t[4] = 99) 68 + table.getn(t) -- length (--> #t) 69 + table.concat(t, ", ") -- join (--> "a, b, c, d") 70 + table.sort(t) -- sort (--> { "a", "b", "c", "d" } 71 + table.sort(t, function(a,b) return a > b end) -- sort (--> { "d", "c", "b", "a" } 72 + table.remove(t, 4) -- remove (--> "d") 73 73 ``` 74 74 75 75 ## Loops