diff options
| author | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2021-10-12 10:04:44 +0800 |
| commit | 60a979e224f26117f5be82bfca757a2483cef0fd (patch) | |
| tree | 7c6af44f6dcada1f23979b820ba830251997b161 /spec/outputs/tables.lua | |
| parent | a19b242cbaf53721b20a3163dd06f43e9ef2b487 (diff) | |
| download | yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.gz yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.tar.bz2 yuescript-60a979e224f26117f5be82bfca757a2483cef0fd.zip | |
fix test.
Diffstat (limited to 'spec/outputs/tables.lua')
| -rw-r--r-- | spec/outputs/tables.lua | 351 |
1 files changed, 351 insertions, 0 deletions
diff --git a/spec/outputs/tables.lua b/spec/outputs/tables.lua new file mode 100644 index 0000000..086e8b3 --- /dev/null +++ b/spec/outputs/tables.lua | |||
| @@ -0,0 +1,351 @@ | |||
| 1 | local backpack = { | ||
| 2 | something = { | ||
| 3 | yeah = 200, | ||
| 4 | they = function() | ||
| 5 | print("hello") | ||
| 6 | return yor_feet("small") | ||
| 7 | end, | ||
| 8 | pretty = hair, | ||
| 9 | gold = hmm | ||
| 10 | }, | ||
| 11 | yow = 1000, | ||
| 12 | eat = goo, | ||
| 13 | yeah = dudd | ||
| 14 | } | ||
| 15 | local start = { | ||
| 16 | something = "cold" | ||
| 17 | } | ||
| 18 | local bathe = { | ||
| 19 | on = "fire" | ||
| 20 | } | ||
| 21 | local another = { | ||
| 22 | [4] = 232, | ||
| 23 | ["good food"] = "is the best" | ||
| 24 | } | ||
| 25 | local fwip = { | ||
| 26 | something = hello("what"), | ||
| 27 | number = 2323, | ||
| 28 | what = yo("momma", "yeah"), | ||
| 29 | fruit = basket, | ||
| 30 | nuts = day | ||
| 31 | } | ||
| 32 | local frick = { | ||
| 33 | hello = "world" | ||
| 34 | } | ||
| 35 | local frack, best = { | ||
| 36 | hello = "world", | ||
| 37 | rice = 3434 | ||
| 38 | }, "what" | ||
| 39 | local ya = { | ||
| 40 | 1, | ||
| 41 | 2, | ||
| 42 | 3, | ||
| 43 | key = 100, | ||
| 44 | 343, | ||
| 45 | "hello", | ||
| 46 | umm = 232 | ||
| 47 | } | ||
| 48 | local x = { | ||
| 49 | 1, | ||
| 50 | 2, | ||
| 51 | 4343, | ||
| 52 | 343, | ||
| 53 | 343 | ||
| 54 | } | ||
| 55 | local g, p = { | ||
| 56 | 1, | ||
| 57 | 2, | ||
| 58 | nowy = "yes", | ||
| 59 | 3, | ||
| 60 | 4, | ||
| 61 | hey = 232, | ||
| 62 | another = "day" | ||
| 63 | }, 234 | ||
| 64 | local annother = { | ||
| 65 | 1, | ||
| 66 | 2, | ||
| 67 | 3, | ||
| 68 | 3, | ||
| 69 | 4, | ||
| 70 | 5, | ||
| 71 | 6, | ||
| 72 | 7, | ||
| 73 | 8 | ||
| 74 | } | ||
| 75 | local yeah = { | ||
| 76 | [232] = 3434, | ||
| 77 | "helo", | ||
| 78 | ice = "cake" | ||
| 79 | } | ||
| 80 | local whatabout = { | ||
| 81 | hello(world, another), | ||
| 82 | what, | ||
| 83 | about, | ||
| 84 | now, | ||
| 85 | hello("world"), | ||
| 86 | yeah, | ||
| 87 | hello("world", yeah) | ||
| 88 | } | ||
| 89 | x = { | ||
| 90 | something = function(self) | ||
| 91 | return "hello" | ||
| 92 | end, | ||
| 93 | cool = { | ||
| 94 | bed = { | ||
| 95 | 2323, | ||
| 96 | 2323 | ||
| 97 | }, | ||
| 98 | red = 2343 | ||
| 99 | }, | ||
| 100 | name = function(self, node) | ||
| 101 | return self:value(node) | ||
| 102 | end | ||
| 103 | } | ||
| 104 | x = { | ||
| 105 | something = something, | ||
| 106 | something = something | ||
| 107 | } | ||
| 108 | local y = { | ||
| 109 | hi = hi, | ||
| 110 | there = there, | ||
| 111 | how = how, | ||
| 112 | you = you, | ||
| 113 | thing = thing | ||
| 114 | } | ||
| 115 | call_me("hello", { | ||
| 116 | x = x, | ||
| 117 | y = y, | ||
| 118 | z = z | ||
| 119 | }) | ||
| 120 | local t = { | ||
| 121 | a = 'a', | ||
| 122 | [b] = 'b' | ||
| 123 | } | ||
| 124 | local xam = { | ||
| 125 | hello = 1234, | ||
| 126 | ["hello"] = 12354, | ||
| 127 | [ [[hello]]] = 12354, | ||
| 128 | ["hello"] = 12354, | ||
| 129 | [ [[hello]]] = 12354 | ||
| 130 | } | ||
| 131 | local kam = { | ||
| 132 | hello = 12, | ||
| 133 | goodcheese = "mmm", | ||
| 134 | yeah = 12 + 232, | ||
| 135 | lets = keepit({ | ||
| 136 | going = true, | ||
| 137 | okay = "yeah" | ||
| 138 | }), | ||
| 139 | more = { | ||
| 140 | 1, | ||
| 141 | (function() | ||
| 142 | local _accum_0 = { } | ||
| 143 | local _len_0 = 1 | ||
| 144 | for x = 1, 10 do | ||
| 145 | _accum_0[_len_0] = x | ||
| 146 | _len_0 = _len_0 + 1 | ||
| 147 | end | ||
| 148 | return _accum_0 | ||
| 149 | end)() | ||
| 150 | }, | ||
| 151 | [{ | ||
| 152 | "one", | ||
| 153 | "two" | ||
| 154 | }] = one_thing(function(self) end) | ||
| 155 | } | ||
| 156 | keepit({ | ||
| 157 | going = true, | ||
| 158 | okay = "yeah", | ||
| 159 | workd = "okay" | ||
| 160 | }) | ||
| 161 | thing({ | ||
| 162 | what = "great", | ||
| 163 | no = "more", | ||
| 164 | okay = 123 | ||
| 165 | }) | ||
| 166 | thing({ | ||
| 167 | what = "great", | ||
| 168 | no = "more" | ||
| 169 | }) | ||
| 170 | local _ = { | ||
| 171 | okay = 123 | ||
| 172 | } | ||
| 173 | local k = { | ||
| 174 | ["hello"] = "world" | ||
| 175 | } | ||
| 176 | k = { | ||
| 177 | ['hello'] = 'world' | ||
| 178 | } | ||
| 179 | k = { | ||
| 180 | ["hello"] = 'world', | ||
| 181 | ["hat"] = "zat" | ||
| 182 | } | ||
| 183 | please({ | ||
| 184 | ["hello"] = "world" | ||
| 185 | }) | ||
| 186 | k = { | ||
| 187 | ["hello"] = "world", | ||
| 188 | ["one"] = "zone" | ||
| 189 | } | ||
| 190 | local f = "one", { | ||
| 191 | ["two"] = three | ||
| 192 | }, "four" | ||
| 193 | f = { | ||
| 194 | ["two"] = three | ||
| 195 | }, "four" | ||
| 196 | f = { | ||
| 197 | "one", | ||
| 198 | ["two"] = three, | ||
| 199 | "four" | ||
| 200 | } | ||
| 201 | local j = "one", { | ||
| 202 | ["two"] = three, | ||
| 203 | ["four"] = five | ||
| 204 | }, 6, 7 | ||
| 205 | local heroine = { | ||
| 206 | name = "Christina", | ||
| 207 | age = 18, | ||
| 208 | job = "Princess", | ||
| 209 | likes = { | ||
| 210 | { | ||
| 211 | name = "kittens", | ||
| 212 | img = "/image/kittens.png" | ||
| 213 | }, | ||
| 214 | { | ||
| 215 | name = "flower", | ||
| 216 | img = "/image/flower.png" | ||
| 217 | } | ||
| 218 | }, | ||
| 219 | items = { | ||
| 220 | { | ||
| 221 | name = "ring", | ||
| 222 | amount = 2 | ||
| 223 | }, | ||
| 224 | { | ||
| 225 | name = "necklace", | ||
| 226 | amount = 1 | ||
| 227 | } | ||
| 228 | }, | ||
| 229 | status = { | ||
| 230 | desc = "weak", | ||
| 231 | { | ||
| 232 | attribute = "health", | ||
| 233 | value = 50 | ||
| 234 | }, | ||
| 235 | { | ||
| 236 | attribute = "mana", | ||
| 237 | value = 100 | ||
| 238 | } | ||
| 239 | } | ||
| 240 | } | ||
| 241 | local inventory = { | ||
| 242 | equipment = { | ||
| 243 | "sword", | ||
| 244 | "shield" | ||
| 245 | }, | ||
| 246 | items = { | ||
| 247 | { | ||
| 248 | name = "potion", | ||
| 249 | count = 10 | ||
| 250 | }, | ||
| 251 | { | ||
| 252 | name = "bread", | ||
| 253 | count = 3 | ||
| 254 | } | ||
| 255 | } | ||
| 256 | } | ||
| 257 | local items = { | ||
| 258 | func(), | ||
| 259 | (function() | ||
| 260 | local _with_0 = tb | ||
| 261 | _with_0.abc = 123 | ||
| 262 | return _with_0 | ||
| 263 | end)(), | ||
| 264 | { | ||
| 265 | 1, | ||
| 266 | 2, | ||
| 267 | 3 | ||
| 268 | }, | ||
| 269 | f({ | ||
| 270 | 1, | ||
| 271 | 2, | ||
| 272 | 3 | ||
| 273 | }), | ||
| 274 | f({ | ||
| 275 | 1, | ||
| 276 | 2, | ||
| 277 | 3 | ||
| 278 | }), | ||
| 279 | (function() | ||
| 280 | local _accum_0 = { } | ||
| 281 | local _len_0 = 1 | ||
| 282 | for i = 1, 3 do | ||
| 283 | _accum_0[_len_0] = i | ||
| 284 | _len_0 = _len_0 + 1 | ||
| 285 | end | ||
| 286 | return _accum_0 | ||
| 287 | end)(), | ||
| 288 | tostring((function() | ||
| 289 | if a then | ||
| 290 | return b | ||
| 291 | end | ||
| 292 | end)()) | ||
| 293 | } | ||
| 294 | local pairs = { | ||
| 295 | { | ||
| 296 | "king", | ||
| 297 | "queen" | ||
| 298 | }, | ||
| 299 | { | ||
| 300 | "hero", | ||
| 301 | "princess" | ||
| 302 | } | ||
| 303 | } | ||
| 304 | items = { | ||
| 305 | { | ||
| 306 | name = "ring", | ||
| 307 | amount = 2 | ||
| 308 | }, | ||
| 309 | { | ||
| 310 | name = "necklace", | ||
| 311 | amount = 1 | ||
| 312 | } | ||
| 313 | } | ||
| 314 | local menus = { | ||
| 315 | { | ||
| 316 | text = "Save", | ||
| 317 | sub = { | ||
| 318 | { | ||
| 319 | text = "Slot 1: " .. (slots[1].name or "None"), | ||
| 320 | click = function() end | ||
| 321 | }, | ||
| 322 | { | ||
| 323 | text = { | ||
| 324 | "Slot 2" | ||
| 325 | }, | ||
| 326 | click = function() end | ||
| 327 | }, | ||
| 328 | { | ||
| 329 | text = [[Slot 3]], | ||
| 330 | click = function() end | ||
| 331 | }, | ||
| 332 | { | ||
| 333 | text = ("Slot 4"):name(), | ||
| 334 | click = function() end | ||
| 335 | }, | ||
| 336 | { | ||
| 337 | text = ({ | ||
| 338 | { | ||
| 339 | "slot5" | ||
| 340 | } | ||
| 341 | })[1]:name(), | ||
| 342 | click = function() end | ||
| 343 | }, | ||
| 344 | [6] = { | ||
| 345 | text = ("Slot 6"), | ||
| 346 | click = function() end | ||
| 347 | } | ||
| 348 | } | ||
| 349 | } | ||
| 350 | } | ||
| 351 | return nil | ||
