github.com/coyove/nj@v0.0.0-20221110084952-c7f8db1065c3/tests/array.nj.lua (about) 1 a = [1,2,3,4] 2 b = a[:2] 3 b += "a" 4 assert(a[2], 'a') 5 print(a) 6 7 8 a = bytes(16) 9 function(i) return i end.map(a, os.numcpus) 10 11 function foo() return a end 12 13 b = foo()[:10] 14 b += 100 15 assert(a[10], 100) 16 17 b = [foo()][(0)][:10] 18 b += 100 19 assert(a[10], 100) 20 21 22 syncMap.Store("a", 1) 23 assert(syncMap.Load("a")[0], 1) 24 25