diff options
Diffstat (limited to 'spec/outputs/codes_from_doc_zh.lua')
| -rw-r--r-- | spec/outputs/codes_from_doc_zh.lua | 5326 |
1 files changed, 2663 insertions, 2663 deletions
diff --git a/spec/outputs/codes_from_doc_zh.lua b/spec/outputs/codes_from_doc_zh.lua index 650d923..e0d364d 100644 --- a/spec/outputs/codes_from_doc_zh.lua +++ b/spec/outputs/codes_from_doc_zh.lua | |||
| @@ -1,159 +1,73 @@ | |||
| 1 | local _module_0 = { } | ||
| 2 | local p, to_lua | ||
| 3 | do | 1 | do |
| 4 | local _obj_0 = require("yue") | 2 | local var = "hello" |
| 5 | p, to_lua = _obj_0.p, _obj_0.to_lua | 3 | print(var) |
| 6 | end | 4 | end |
| 7 | local inventory = { | 5 | print(var) |
| 8 | equipment = { | 6 | local counter |
| 9 | "sword", | 7 | do |
| 10 | "shield" | 8 | local i = 0 |
| 11 | }, | 9 | counter = function() |
| 12 | items = { | 10 | i = i + 1 |
| 13 | { | 11 | return i |
| 14 | name = "potion", | ||
| 15 | count = 10 | ||
| 16 | }, | ||
| 17 | { | ||
| 18 | name = "bread", | ||
| 19 | count = 3 | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
| 23 | local map | ||
| 24 | map = function(arr, action) | ||
| 25 | local _accum_0 = { } | ||
| 26 | local _len_0 = 1 | ||
| 27 | for _index_0 = 1, #arr do | ||
| 28 | local item = arr[_index_0] | ||
| 29 | _accum_0[_len_0] = action(item) | ||
| 30 | _len_0 = _len_0 + 1 | ||
| 31 | end | 12 | end |
| 32 | return _accum_0 | ||
| 33 | end | 13 | end |
| 34 | local filter | 14 | print(counter()) |
| 35 | filter = function(arr, cond) | 15 | print(counter()) |
| 36 | local _accum_0 = { } | 16 | local tbl = { |
| 37 | local _len_0 = 1 | 17 | key = (function() |
| 38 | for _index_0 = 1, #arr do | 18 | print("分配键值!") |
| 39 | local item = arr[_index_0] | 19 | return 1234 |
| 40 | if cond(item) then | 20 | end)() |
| 41 | _accum_0[_len_0] = item | 21 | } |
| 42 | _len_0 = _len_0 + 1 | 22 | do |
| 43 | end | 23 | local var = "hello" |
| 44 | end | 24 | print(var) |
| 45 | return _accum_0 | ||
| 46 | end | 25 | end |
| 47 | local reduce | 26 | print(var) |
| 48 | reduce = function(arr, init, action) | 27 | local counter |
| 49 | for _index_0 = 1, #arr do | 28 | do |
| 50 | local item = arr[_index_0] | 29 | local i = 0 |
| 51 | init = action(init, item) | 30 | counter = function() |
| 31 | i = i + 1 | ||
| 32 | return i | ||
| 52 | end | 33 | end |
| 53 | return init | ||
| 54 | end | 34 | end |
| 55 | print(reduce(filter(map({ | 35 | print(counter()) |
| 56 | 1, | 36 | print(counter()) |
| 57 | 2, | 37 | local tbl = { |
| 58 | 3 | 38 | key = (function() |
| 59 | }, function(x) | 39 | print("分配键值!") |
| 60 | return x * 2 | 40 | return 1234 |
| 61 | end), function(x) | 41 | end)() |
| 62 | return x > 4 | 42 | } |
| 63 | end), 0, function(a, b) | 43 | if name == "Rob" then |
| 64 | return a + b | 44 | print("你好,世界") |
| 65 | end)) | ||
| 66 | local apple = setmetatable({ | ||
| 67 | size = 15, | ||
| 68 | }, { | ||
| 69 | __index = { | ||
| 70 | color = 0x00ffff | ||
| 71 | } | ||
| 72 | }) | ||
| 73 | if (getmetatable(apple) ~= nil) then | ||
| 74 | p(apple.size, apple.color, getmetatable(apple).__index) | ||
| 75 | end | 45 | end |
| 76 | local _u1f31b = "月之脚本" | 46 | local _list_0 = items |
| 77 | _module_0["🌛"] = _u1f31b | 47 | for _index_0 = 1, #_list_0 do |
| 78 | return _module_0 | 48 | local item = _list_0[_index_0] |
| 79 | local _module_0 = { } | 49 | print("项目: ", item) |
| 80 | local p, to_lua | ||
| 81 | do | ||
| 82 | local _obj_0 = require("yue") | ||
| 83 | p, to_lua = _obj_0.p, _obj_0.to_lua | ||
| 84 | end | 50 | end |
| 85 | local inventory = { | 51 | while game:isRunning() do |
| 86 | equipment = { | 52 | game:update() |
| 87 | "sword", | ||
| 88 | "shield" | ||
| 89 | }, | ||
| 90 | items = { | ||
| 91 | { | ||
| 92 | name = "potion", | ||
| 93 | count = 10 | ||
| 94 | }, | ||
| 95 | { | ||
| 96 | name = "bread", | ||
| 97 | count = 3 | ||
| 98 | } | ||
| 99 | } | ||
| 100 | } | ||
| 101 | local map | ||
| 102 | map = function(arr, action) | ||
| 103 | local _accum_0 = { } | ||
| 104 | local _len_0 = 1 | ||
| 105 | for _index_0 = 1, #arr do | ||
| 106 | local item = arr[_index_0] | ||
| 107 | _accum_0[_len_0] = action(item) | ||
| 108 | _len_0 = _len_0 + 1 | ||
| 109 | end | ||
| 110 | return _accum_0 | ||
| 111 | end | 53 | end |
| 112 | local filter | 54 | while not reader:eof() do |
| 113 | filter = function(arr, cond) | 55 | reader:parse_line() |
| 114 | local _accum_0 = { } | ||
| 115 | local _len_0 = 1 | ||
| 116 | for _index_0 = 1, #arr do | ||
| 117 | local item = arr[_index_0] | ||
| 118 | if cond(item) then | ||
| 119 | _accum_0[_len_0] = item | ||
| 120 | _len_0 = _len_0 + 1 | ||
| 121 | end | ||
| 122 | end | ||
| 123 | return _accum_0 | ||
| 124 | end | 56 | end |
| 125 | local reduce | 57 | if name == "Rob" then |
| 126 | reduce = function(arr, init, action) | 58 | print("你好,世界") |
| 127 | for _index_0 = 1, #arr do | ||
| 128 | local item = arr[_index_0] | ||
| 129 | init = action(init, item) | ||
| 130 | end | ||
| 131 | return init | ||
| 132 | end | 59 | end |
| 133 | print(reduce(filter(map({ | 60 | local _list_0 = items |
| 134 | 1, | 61 | for _index_0 = 1, #_list_0 do |
| 135 | 2, | 62 | local item = _list_0[_index_0] |
| 136 | 3 | 63 | print("项目: ", item) |
| 137 | }, function(x) | 64 | end |
| 138 | return x * 2 | 65 | while game:isRunning() do |
| 139 | end), function(x) | 66 | game:update() |
| 140 | return x > 4 | 67 | end |
| 141 | end), 0, function(a, b) | 68 | while not reader:eof() do |
| 142 | return a + b | 69 | reader:parse_line() |
| 143 | end)) | ||
| 144 | local apple = setmetatable({ | ||
| 145 | size = 15, | ||
| 146 | }, { | ||
| 147 | __index = { | ||
| 148 | color = 0x00ffff | ||
| 149 | } | ||
| 150 | }) | ||
| 151 | if (getmetatable(apple) ~= nil) then | ||
| 152 | p(apple.size, apple.color, getmetatable(apple).__index) | ||
| 153 | end | 70 | end |
| 154 | local _u1f31b = "月之脚本" | ||
| 155 | _module_0["🌛"] = _u1f31b | ||
| 156 | return _module_0 | ||
| 157 | local area = 6.2831853071796 * 5 | 71 | local area = 6.2831853071796 * 5 |
| 158 | print('你好 世界') | 72 | print('你好 世界') |
| 159 | do | 73 | do |
| @@ -232,592 +146,6 @@ end | |||
| 232 | do | 146 | do |
| 233 | print(123, "hello") | 147 | print(123, "hello") |
| 234 | end | 148 | end |
| 235 | if tb ~= nil then | ||
| 236 | tb:func() | ||
| 237 | end | ||
| 238 | if tb ~= nil then | ||
| 239 | tb:func() | ||
| 240 | end | ||
| 241 | print(1 < 2 and 2 <= 2 and 2 < 3 and 3 == 3 and 3 > 2 and 2 >= 1 and 1 == 1 and 1 < 3 and 3 ~= 5) | ||
| 242 | local a = 5 | ||
| 243 | print(1 <= a and a <= 10) | ||
| 244 | local v | ||
| 245 | v = function(x) | ||
| 246 | print(x) | ||
| 247 | return x | ||
| 248 | end | ||
| 249 | print((function() | ||
| 250 | local _cond_0 = v(2) | ||
| 251 | if not (v(1) < _cond_0) then | ||
| 252 | return false | ||
| 253 | else | ||
| 254 | return _cond_0 <= v(3) | ||
| 255 | end | ||
| 256 | end)()) | ||
| 257 | print((function() | ||
| 258 | local _cond_0 = v(2) | ||
| 259 | if not (v(1) > _cond_0) then | ||
| 260 | return false | ||
| 261 | else | ||
| 262 | return _cond_0 <= v(3) | ||
| 263 | end | ||
| 264 | end)()) | ||
| 265 | local tab = { } | ||
| 266 | tab[#tab + 1] = "Value" | ||
| 267 | local tbA = { | ||
| 268 | 1, | ||
| 269 | 2, | ||
| 270 | 3 | ||
| 271 | } | ||
| 272 | local tbB = { | ||
| 273 | 4, | ||
| 274 | 5, | ||
| 275 | 6 | ||
| 276 | } | ||
| 277 | local _len_0 = #tbA + 1 | ||
| 278 | for _index_0 = 1, #tbB do | ||
| 279 | local _elm_0 = tbB[_index_0] | ||
| 280 | tbA[_len_0], _len_0 = _elm_0, _len_0 + 1 | ||
| 281 | end | ||
| 282 | local parts = { | ||
| 283 | "shoulders", | ||
| 284 | "knees" | ||
| 285 | } | ||
| 286 | local lyrics | ||
| 287 | do | ||
| 288 | local _tab_0 = { | ||
| 289 | "head" | ||
| 290 | } | ||
| 291 | local _idx_0 = 1 | ||
| 292 | for _key_0, _value_0 in pairs(parts) do | ||
| 293 | if _idx_0 == _key_0 then | ||
| 294 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 295 | _idx_0 = _idx_0 + 1 | ||
| 296 | else | ||
| 297 | _tab_0[_key_0] = _value_0 | ||
| 298 | end | ||
| 299 | end | ||
| 300 | _tab_0[#_tab_0 + 1] = "and" | ||
| 301 | _tab_0[#_tab_0 + 1] = "toes" | ||
| 302 | lyrics = _tab_0 | ||
| 303 | end | ||
| 304 | local copy | ||
| 305 | do | ||
| 306 | local _tab_0 = { } | ||
| 307 | local _idx_0 = 1 | ||
| 308 | for _key_0, _value_0 in pairs(other) do | ||
| 309 | if _idx_0 == _key_0 then | ||
| 310 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 311 | _idx_0 = _idx_0 + 1 | ||
| 312 | else | ||
| 313 | _tab_0[_key_0] = _value_0 | ||
| 314 | end | ||
| 315 | end | ||
| 316 | copy = _tab_0 | ||
| 317 | end | ||
| 318 | local a = { | ||
| 319 | 1, | ||
| 320 | 2, | ||
| 321 | 3, | ||
| 322 | x = 1 | ||
| 323 | } | ||
| 324 | local b = { | ||
| 325 | 4, | ||
| 326 | 5, | ||
| 327 | y = 1 | ||
| 328 | } | ||
| 329 | local merge | ||
| 330 | local _tab_0 = { } | ||
| 331 | local _idx_0 = 1 | ||
| 332 | for _key_0, _value_0 in pairs(a) do | ||
| 333 | if _idx_0 == _key_0 then | ||
| 334 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 335 | _idx_0 = _idx_0 + 1 | ||
| 336 | else | ||
| 337 | _tab_0[_key_0] = _value_0 | ||
| 338 | end | ||
| 339 | end | ||
| 340 | local _idx_1 = 1 | ||
| 341 | for _key_0, _value_0 in pairs(b) do | ||
| 342 | if _idx_1 == _key_0 then | ||
| 343 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 344 | _idx_1 = _idx_1 + 1 | ||
| 345 | else | ||
| 346 | _tab_0[_key_0] = _value_0 | ||
| 347 | end | ||
| 348 | end | ||
| 349 | merge = _tab_0 | ||
| 350 | local last | ||
| 351 | do | ||
| 352 | local _item_0 = data.items | ||
| 353 | last = _item_0[#_item_0] | ||
| 354 | end | ||
| 355 | local second_last | ||
| 356 | do | ||
| 357 | local _item_0 = data.items | ||
| 358 | second_last = _item_0[#_item_0 - 1] | ||
| 359 | end | ||
| 360 | local _obj_0 = data.items | ||
| 361 | _obj_0[#_obj_0] = 1 | ||
| 362 | local mt = { } | ||
| 363 | local add | ||
| 364 | add = function(self, right) | ||
| 365 | return setmetatable({ | ||
| 366 | value = self.value + right.value | ||
| 367 | }, mt) | ||
| 368 | end | ||
| 369 | mt.__add = add | ||
| 370 | local a = setmetatable({ | ||
| 371 | value = 1 | ||
| 372 | }, mt) | ||
| 373 | local b = setmetatable({ | ||
| 374 | value = 2 | ||
| 375 | }, { | ||
| 376 | __add = add | ||
| 377 | }) | ||
| 378 | local c = setmetatable({ | ||
| 379 | value = 3 | ||
| 380 | }, { | ||
| 381 | __add = mt.__add | ||
| 382 | }) | ||
| 383 | local d = a + b + c | ||
| 384 | print(d.value) | ||
| 385 | local _ <close> = setmetatable({ }, { | ||
| 386 | __close = function() | ||
| 387 | return print("超出范围") | ||
| 388 | end | ||
| 389 | }) | ||
| 390 | local tb = setmetatable({ }, { | ||
| 391 | ["value"] = 123 | ||
| 392 | }) | ||
| 393 | getmetatable(tb).__index = getmetatable(tb) | ||
| 394 | print(tb.value) | ||
| 395 | setmetatable(tb, { | ||
| 396 | __index = { | ||
| 397 | item = "hello" | ||
| 398 | } | ||
| 399 | }) | ||
| 400 | print(tb.item) | ||
| 401 | local item, new, close, getter | ||
| 402 | do | ||
| 403 | local _obj_0 = tb | ||
| 404 | item, new = _obj_0[1], _obj_0.new | ||
| 405 | do | ||
| 406 | local _obj_1 = getmetatable(_obj_0) | ||
| 407 | close, getter = _obj_1.__close, _obj_1.__index | ||
| 408 | end | ||
| 409 | end | ||
| 410 | print(item, new, close, getter) | ||
| 411 | do | ||
| 412 | local _obj_0 = func | ||
| 413 | if _obj_0 ~= nil then | ||
| 414 | _obj_0() | ||
| 415 | end | ||
| 416 | end | ||
| 417 | print((function() | ||
| 418 | local _obj_0 = abc | ||
| 419 | if _obj_0 ~= nil then | ||
| 420 | local _obj_1 = _obj_0["你好 世界"] | ||
| 421 | if _obj_1 ~= nil then | ||
| 422 | return _obj_1.xyz | ||
| 423 | end | ||
| 424 | return nil | ||
| 425 | end | ||
| 426 | return nil | ||
| 427 | end)()) | ||
| 428 | local x | ||
| 429 | do | ||
| 430 | local _obj_0 = tab | ||
| 431 | if _obj_0 ~= nil then | ||
| 432 | x = _obj_0.value | ||
| 433 | end | ||
| 434 | end | ||
| 435 | local len = (function() | ||
| 436 | local _obj_0 = utf8 | ||
| 437 | if _obj_0 ~= nil then | ||
| 438 | return _obj_0.len | ||
| 439 | end | ||
| 440 | return nil | ||
| 441 | end)() or (function() | ||
| 442 | local _obj_0 = string | ||
| 443 | if _obj_0 ~= nil then | ||
| 444 | return _obj_0.len | ||
| 445 | end | ||
| 446 | return nil | ||
| 447 | end)() or function(o) | ||
| 448 | return #o | ||
| 449 | end | ||
| 450 | if print and (x ~= nil) then | ||
| 451 | print(x) | ||
| 452 | end | ||
| 453 | local _with_0 = io.open("test.txt", "w") | ||
| 454 | if _with_0 ~= nil then | ||
| 455 | _with_0:write("你好") | ||
| 456 | _with_0:close() | ||
| 457 | end | ||
| 458 | print("你好") | ||
| 459 | print(1, 2) | ||
| 460 | print(1, 2, 3) | ||
| 461 | print(render(emit(parse(extract(readFile("example.txt"), language, { }), language)))) | ||
| 462 | local a, b, c, d | ||
| 463 | if b ~= nil then | ||
| 464 | a = b | ||
| 465 | else | ||
| 466 | if c ~= nil then | ||
| 467 | a = c | ||
| 468 | else | ||
| 469 | a = d | ||
| 470 | end | ||
| 471 | end | ||
| 472 | func((function() | ||
| 473 | if a ~= nil then | ||
| 474 | return a | ||
| 475 | else | ||
| 476 | return { } | ||
| 477 | end | ||
| 478 | end)()) | ||
| 479 | if a == nil then | ||
| 480 | a = false | ||
| 481 | end | ||
| 482 | local list = { | ||
| 483 | 1, | ||
| 484 | 2, | ||
| 485 | 3 | ||
| 486 | } | ||
| 487 | func({ | ||
| 488 | 1, | ||
| 489 | 2, | ||
| 490 | 3 | ||
| 491 | }) | ||
| 492 | local f | ||
| 493 | f = function() | ||
| 494 | return { | ||
| 495 | 1, | ||
| 496 | 2, | ||
| 497 | 3 | ||
| 498 | } | ||
| 499 | end | ||
| 500 | local tb = { | ||
| 501 | name = "abc", | ||
| 502 | values = { | ||
| 503 | "a", | ||
| 504 | "b", | ||
| 505 | "c" | ||
| 506 | }, | ||
| 507 | objects = { | ||
| 508 | { | ||
| 509 | name = "a", | ||
| 510 | value = 1, | ||
| 511 | func = function(self) | ||
| 512 | return self.value + 1 | ||
| 513 | end, | ||
| 514 | tb = { | ||
| 515 | fieldA = 1 | ||
| 516 | } | ||
| 517 | }, | ||
| 518 | { | ||
| 519 | name = "b", | ||
| 520 | value = 2, | ||
| 521 | func = function(self) | ||
| 522 | return self.value + 2 | ||
| 523 | end, | ||
| 524 | tb = { } | ||
| 525 | } | ||
| 526 | } | ||
| 527 | } | ||
| 528 | if tb ~= nil then | ||
| 529 | tb:func() | ||
| 530 | end | ||
| 531 | if tb ~= nil then | ||
| 532 | tb:func() | ||
| 533 | end | ||
| 534 | print(1 < 2 and 2 <= 2 and 2 < 3 and 3 == 3 and 3 > 2 and 2 >= 1 and 1 == 1 and 1 < 3 and 3 ~= 5) | ||
| 535 | local a = 5 | ||
| 536 | print(1 <= a and a <= 10) | ||
| 537 | local v | ||
| 538 | v = function(x) | ||
| 539 | print(x) | ||
| 540 | return x | ||
| 541 | end | ||
| 542 | print((function() | ||
| 543 | local _cond_0 = v(2) | ||
| 544 | if not (v(1) < _cond_0) then | ||
| 545 | return false | ||
| 546 | else | ||
| 547 | return _cond_0 <= v(3) | ||
| 548 | end | ||
| 549 | end)()) | ||
| 550 | print((function() | ||
| 551 | local _cond_0 = v(2) | ||
| 552 | if not (v(1) > _cond_0) then | ||
| 553 | return false | ||
| 554 | else | ||
| 555 | return _cond_0 <= v(3) | ||
| 556 | end | ||
| 557 | end)()) | ||
| 558 | local tab = { } | ||
| 559 | tab[#tab + 1] = "Value" | ||
| 560 | local tbA = { | ||
| 561 | 1, | ||
| 562 | 2, | ||
| 563 | 3 | ||
| 564 | } | ||
| 565 | local tbB = { | ||
| 566 | 4, | ||
| 567 | 5, | ||
| 568 | 6 | ||
| 569 | } | ||
| 570 | local _len_0 = #tbA + 1 | ||
| 571 | for _index_0 = 1, #tbB do | ||
| 572 | local _elm_0 = tbB[_index_0] | ||
| 573 | tbA[_len_0], _len_0 = _elm_0, _len_0 + 1 | ||
| 574 | end | ||
| 575 | local parts = { | ||
| 576 | "shoulders", | ||
| 577 | "knees" | ||
| 578 | } | ||
| 579 | local lyrics | ||
| 580 | do | ||
| 581 | local _tab_0 = { | ||
| 582 | "head" | ||
| 583 | } | ||
| 584 | local _idx_0 = 1 | ||
| 585 | for _key_0, _value_0 in pairs(parts) do | ||
| 586 | if _idx_0 == _key_0 then | ||
| 587 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 588 | _idx_0 = _idx_0 + 1 | ||
| 589 | else | ||
| 590 | _tab_0[_key_0] = _value_0 | ||
| 591 | end | ||
| 592 | end | ||
| 593 | _tab_0[#_tab_0 + 1] = "and" | ||
| 594 | _tab_0[#_tab_0 + 1] = "toes" | ||
| 595 | lyrics = _tab_0 | ||
| 596 | end | ||
| 597 | local copy | ||
| 598 | do | ||
| 599 | local _tab_0 = { } | ||
| 600 | local _idx_0 = 1 | ||
| 601 | for _key_0, _value_0 in pairs(other) do | ||
| 602 | if _idx_0 == _key_0 then | ||
| 603 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 604 | _idx_0 = _idx_0 + 1 | ||
| 605 | else | ||
| 606 | _tab_0[_key_0] = _value_0 | ||
| 607 | end | ||
| 608 | end | ||
| 609 | copy = _tab_0 | ||
| 610 | end | ||
| 611 | local a = { | ||
| 612 | 1, | ||
| 613 | 2, | ||
| 614 | 3, | ||
| 615 | x = 1 | ||
| 616 | } | ||
| 617 | local b = { | ||
| 618 | 4, | ||
| 619 | 5, | ||
| 620 | y = 1 | ||
| 621 | } | ||
| 622 | local merge | ||
| 623 | local _tab_0 = { } | ||
| 624 | local _idx_0 = 1 | ||
| 625 | for _key_0, _value_0 in pairs(a) do | ||
| 626 | if _idx_0 == _key_0 then | ||
| 627 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 628 | _idx_0 = _idx_0 + 1 | ||
| 629 | else | ||
| 630 | _tab_0[_key_0] = _value_0 | ||
| 631 | end | ||
| 632 | end | ||
| 633 | local _idx_1 = 1 | ||
| 634 | for _key_0, _value_0 in pairs(b) do | ||
| 635 | if _idx_1 == _key_0 then | ||
| 636 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 637 | _idx_1 = _idx_1 + 1 | ||
| 638 | else | ||
| 639 | _tab_0[_key_0] = _value_0 | ||
| 640 | end | ||
| 641 | end | ||
| 642 | merge = _tab_0 | ||
| 643 | local last | ||
| 644 | do | ||
| 645 | local _item_0 = data.items | ||
| 646 | last = _item_0[#_item_0] | ||
| 647 | end | ||
| 648 | local second_last | ||
| 649 | do | ||
| 650 | local _item_0 = data.items | ||
| 651 | second_last = _item_0[#_item_0 - 1] | ||
| 652 | end | ||
| 653 | local _obj_0 = data.items | ||
| 654 | _obj_0[#_obj_0] = 1 | ||
| 655 | local mt = { } | ||
| 656 | local add | ||
| 657 | add = function(self, right) | ||
| 658 | return setmetatable({ | ||
| 659 | value = self.value + right.value | ||
| 660 | }, mt) | ||
| 661 | end | ||
| 662 | mt.__add = add | ||
| 663 | local a = setmetatable({ | ||
| 664 | value = 1 | ||
| 665 | }, mt) | ||
| 666 | local b = setmetatable({ | ||
| 667 | value = 2 | ||
| 668 | }, { | ||
| 669 | __add = add | ||
| 670 | }) | ||
| 671 | local c = setmetatable({ | ||
| 672 | value = 3 | ||
| 673 | }, { | ||
| 674 | __add = mt.__add | ||
| 675 | }) | ||
| 676 | local d = a + b + c | ||
| 677 | print(d.value) | ||
| 678 | local _ <close> = setmetatable({ }, { | ||
| 679 | __close = function() | ||
| 680 | return print("超出范围") | ||
| 681 | end | ||
| 682 | }) | ||
| 683 | local tb = setmetatable({ }, { | ||
| 684 | ["value"] = 123 | ||
| 685 | }) | ||
| 686 | getmetatable(tb).__index = getmetatable(tb) | ||
| 687 | print(tb.value) | ||
| 688 | setmetatable(tb, { | ||
| 689 | __index = { | ||
| 690 | item = "hello" | ||
| 691 | } | ||
| 692 | }) | ||
| 693 | print(tb.item) | ||
| 694 | local item, new, close, getter | ||
| 695 | do | ||
| 696 | local _obj_0 = tb | ||
| 697 | item, new = _obj_0[1], _obj_0.new | ||
| 698 | do | ||
| 699 | local _obj_1 = getmetatable(_obj_0) | ||
| 700 | close, getter = _obj_1.__close, _obj_1.__index | ||
| 701 | end | ||
| 702 | end | ||
| 703 | print(item, new, close, getter) | ||
| 704 | do | ||
| 705 | local _obj_0 = func | ||
| 706 | if _obj_0 ~= nil then | ||
| 707 | _obj_0() | ||
| 708 | end | ||
| 709 | end | ||
| 710 | print((function() | ||
| 711 | local _obj_0 = abc | ||
| 712 | if _obj_0 ~= nil then | ||
| 713 | local _obj_1 = _obj_0["你好 世界"] | ||
| 714 | if _obj_1 ~= nil then | ||
| 715 | return _obj_1.xyz | ||
| 716 | end | ||
| 717 | return nil | ||
| 718 | end | ||
| 719 | return nil | ||
| 720 | end)()) | ||
| 721 | local x | ||
| 722 | do | ||
| 723 | local _obj_0 = tab | ||
| 724 | if _obj_0 ~= nil then | ||
| 725 | x = _obj_0.value | ||
| 726 | end | ||
| 727 | end | ||
| 728 | local len = (function() | ||
| 729 | local _obj_0 = utf8 | ||
| 730 | if _obj_0 ~= nil then | ||
| 731 | return _obj_0.len | ||
| 732 | end | ||
| 733 | return nil | ||
| 734 | end)() or (function() | ||
| 735 | local _obj_0 = string | ||
| 736 | if _obj_0 ~= nil then | ||
| 737 | return _obj_0.len | ||
| 738 | end | ||
| 739 | return nil | ||
| 740 | end)() or function(o) | ||
| 741 | return #o | ||
| 742 | end | ||
| 743 | if print and (x ~= nil) then | ||
| 744 | print(x) | ||
| 745 | end | ||
| 746 | local _with_0 = io.open("test.txt", "w") | ||
| 747 | if _with_0 ~= nil then | ||
| 748 | _with_0:write("你好") | ||
| 749 | _with_0:close() | ||
| 750 | end | ||
| 751 | print("你好") | ||
| 752 | print(1, 2) | ||
| 753 | print(1, 2, 3) | ||
| 754 | print(render(emit(parse(extract(readFile("example.txt"), language, { }), language)))) | ||
| 755 | local a, b, c, d | ||
| 756 | if b ~= nil then | ||
| 757 | a = b | ||
| 758 | else | ||
| 759 | if c ~= nil then | ||
| 760 | a = c | ||
| 761 | else | ||
| 762 | a = d | ||
| 763 | end | ||
| 764 | end | ||
| 765 | func((function() | ||
| 766 | if a ~= nil then | ||
| 767 | return a | ||
| 768 | else | ||
| 769 | return { } | ||
| 770 | end | ||
| 771 | end)()) | ||
| 772 | if a == nil then | ||
| 773 | a = false | ||
| 774 | end | ||
| 775 | local list = { | ||
| 776 | 1, | ||
| 777 | 2, | ||
| 778 | 3 | ||
| 779 | } | ||
| 780 | func({ | ||
| 781 | 1, | ||
| 782 | 2, | ||
| 783 | 3 | ||
| 784 | }) | ||
| 785 | local f | ||
| 786 | f = function() | ||
| 787 | return { | ||
| 788 | 1, | ||
| 789 | 2, | ||
| 790 | 3 | ||
| 791 | } | ||
| 792 | end | ||
| 793 | local tb = { | ||
| 794 | name = "abc", | ||
| 795 | values = { | ||
| 796 | "a", | ||
| 797 | "b", | ||
| 798 | "c" | ||
| 799 | }, | ||
| 800 | objects = { | ||
| 801 | { | ||
| 802 | name = "a", | ||
| 803 | value = 1, | ||
| 804 | func = function(self) | ||
| 805 | return self.value + 1 | ||
| 806 | end, | ||
| 807 | tb = { | ||
| 808 | fieldA = 1 | ||
| 809 | } | ||
| 810 | }, | ||
| 811 | { | ||
| 812 | name = "b", | ||
| 813 | value = 2, | ||
| 814 | func = function(self) | ||
| 815 | return self.value + 2 | ||
| 816 | end, | ||
| 817 | tb = { } | ||
| 818 | } | ||
| 819 | } | ||
| 820 | } | ||
| 821 | do | 149 | do |
| 822 | local insert, concat = table.insert, table.concat | 150 | local insert, concat = table.insert, table.concat |
| 823 | local C, Ct, Cmt | 151 | local C, Ct, Cmt |
| @@ -1080,460 +408,6 @@ _module_0 = function() | |||
| 1080 | return 123 | 408 | return 123 |
| 1081 | end | 409 | end |
| 1082 | return _module_0 | 410 | return _module_0 |
| 1083 | local hello = "world" | ||
| 1084 | local a, b, c = 1, 2, 3 | ||
| 1085 | hello = 123 | ||
| 1086 | local x = 1 | ||
| 1087 | x = x + 1 | ||
| 1088 | x = x - 1 | ||
| 1089 | x = x * 10 | ||
| 1090 | x = x / 10 | ||
| 1091 | x = x % 10 | ||
| 1092 | local s = s .. "world" | ||
| 1093 | local arg = arg or "默认值" | ||
| 1094 | local a = 0 | ||
| 1095 | local b = 0 | ||
| 1096 | local c = 0 | ||
| 1097 | local d = 0 | ||
| 1098 | local e = 0 | ||
| 1099 | local x = f() | ||
| 1100 | local y = x | ||
| 1101 | local z = x | ||
| 1102 | do | ||
| 1103 | local a = 1 | ||
| 1104 | local x, y, z | ||
| 1105 | print("预先声明后续所有变量为局部变量") | ||
| 1106 | x = function() | ||
| 1107 | return 1 + y + z | ||
| 1108 | end | ||
| 1109 | y, z = 2, 3 | ||
| 1110 | instance = Item:new() | ||
| 1111 | end | ||
| 1112 | do | ||
| 1113 | local X = 1 | ||
| 1114 | local B | ||
| 1115 | print("只预先声明后续大写的变量为局部变量") | ||
| 1116 | local a = 1 | ||
| 1117 | B = 2 | ||
| 1118 | end | ||
| 1119 | do | ||
| 1120 | a = 1 | ||
| 1121 | print("预先声明所有变量为全局变量") | ||
| 1122 | x = function() | ||
| 1123 | return 1 + y + z | ||
| 1124 | end | ||
| 1125 | y, z = 2, 3 | ||
| 1126 | end | ||
| 1127 | do | ||
| 1128 | x = 1 | ||
| 1129 | print("只预先声明大写的变量为全局变量") | ||
| 1130 | local a = 1 | ||
| 1131 | B = 2 | ||
| 1132 | local Temp = "一个局部值" | ||
| 1133 | end | ||
| 1134 | local hello = "world" | ||
| 1135 | local a, b, c = 1, 2, 3 | ||
| 1136 | hello = 123 | ||
| 1137 | local x = 1 | ||
| 1138 | x = x + 1 | ||
| 1139 | x = x - 1 | ||
| 1140 | x = x * 10 | ||
| 1141 | x = x / 10 | ||
| 1142 | x = x % 10 | ||
| 1143 | local s = s .. "world" | ||
| 1144 | local arg = arg or "默认值" | ||
| 1145 | local a = 0 | ||
| 1146 | local b = 0 | ||
| 1147 | local c = 0 | ||
| 1148 | local d = 0 | ||
| 1149 | local e = 0 | ||
| 1150 | local x = f() | ||
| 1151 | local y = x | ||
| 1152 | local z = x | ||
| 1153 | do | ||
| 1154 | local a = 1 | ||
| 1155 | local x, y, z | ||
| 1156 | print("预先声明后续所有变量为局部变量") | ||
| 1157 | x = function() | ||
| 1158 | return 1 + y + z | ||
| 1159 | end | ||
| 1160 | y, z = 2, 3 | ||
| 1161 | instance = Item:new() | ||
| 1162 | end | ||
| 1163 | do | ||
| 1164 | local X = 1 | ||
| 1165 | local B | ||
| 1166 | print("只预先声明后续大写的变量为局部变量") | ||
| 1167 | local a = 1 | ||
| 1168 | B = 2 | ||
| 1169 | end | ||
| 1170 | do | ||
| 1171 | a = 1 | ||
| 1172 | print("预先声明所有变量为全局变量") | ||
| 1173 | x = function() | ||
| 1174 | return 1 + y + z | ||
| 1175 | end | ||
| 1176 | y, z = 2, 3 | ||
| 1177 | end | ||
| 1178 | do | ||
| 1179 | x = 1 | ||
| 1180 | print("只预先声明大写的变量为全局变量") | ||
| 1181 | local a = 1 | ||
| 1182 | B = 2 | ||
| 1183 | local Temp = "一个局部值" | ||
| 1184 | end | ||
| 1185 | local thing = { | ||
| 1186 | 1, | ||
| 1187 | 2 | ||
| 1188 | } | ||
| 1189 | local a, b = thing[1], thing[2] | ||
| 1190 | print(a, b) | ||
| 1191 | local obj = { | ||
| 1192 | hello = "world", | ||
| 1193 | day = "tuesday", | ||
| 1194 | length = 20 | ||
| 1195 | } | ||
| 1196 | local hello, the_day = obj.hello, obj.day | ||
| 1197 | print(hello, the_day) | ||
| 1198 | local day = obj.day | ||
| 1199 | local obj2 = { | ||
| 1200 | numbers = { | ||
| 1201 | 1, | ||
| 1202 | 2, | ||
| 1203 | 3, | ||
| 1204 | 4 | ||
| 1205 | }, | ||
| 1206 | properties = { | ||
| 1207 | color = "green", | ||
| 1208 | height = 13.5 | ||
| 1209 | } | ||
| 1210 | } | ||
| 1211 | local first, second, color = obj2.numbers[1], obj2.numbers[2], obj2.properties.color | ||
| 1212 | print(first, second, color) | ||
| 1213 | local first, second, color | ||
| 1214 | local _obj_0 = obj2 | ||
| 1215 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color | ||
| 1216 | local concat, insert | ||
| 1217 | local _obj_0 = table | ||
| 1218 | concat, insert = _obj_0.concat, _obj_0.insert | ||
| 1219 | local mix, max, rand | ||
| 1220 | local _obj_0 = math | ||
| 1221 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random | ||
| 1222 | local name, job | ||
| 1223 | local _obj_0 = person | ||
| 1224 | name, job = _obj_0.name, _obj_0.job | ||
| 1225 | if name == nil then | ||
| 1226 | name = "nameless" | ||
| 1227 | end | ||
| 1228 | if job == nil then | ||
| 1229 | job = "jobless" | ||
| 1230 | end | ||
| 1231 | local two, four | ||
| 1232 | local _obj_0 = items | ||
| 1233 | two, four = _obj_0[2], _obj_0[4] | ||
| 1234 | local orders = { | ||
| 1235 | "first", | ||
| 1236 | "second", | ||
| 1237 | "third", | ||
| 1238 | "fourth", | ||
| 1239 | "last" | ||
| 1240 | } | ||
| 1241 | local first, bulk, last = orders[1], (function() | ||
| 1242 | local _accum_0 = { } | ||
| 1243 | local _len_0 = 1 | ||
| 1244 | local _max_0 = #orders + -2 + 1 | ||
| 1245 | for _index_0 = 2, _max_0 do | ||
| 1246 | local _item_0 = orders[_index_0] | ||
| 1247 | _accum_0[_len_0] = _item_0 | ||
| 1248 | _len_0 = _len_0 + 1 | ||
| 1249 | end | ||
| 1250 | return _accum_0 | ||
| 1251 | end)(), orders[#orders] | ||
| 1252 | print(first) | ||
| 1253 | print(bulk) | ||
| 1254 | print(last) | ||
| 1255 | local first, rest | ||
| 1256 | do | ||
| 1257 | local _obj_0 = orders | ||
| 1258 | first, rest = _obj_0[1], (function() | ||
| 1259 | local _accum_0 = { } | ||
| 1260 | local _len_0 = 1 | ||
| 1261 | local _max_0 = #_obj_0 | ||
| 1262 | for _index_0 = 2, _max_0 do | ||
| 1263 | local _item_0 = _obj_0[_index_0] | ||
| 1264 | _accum_0[_len_0] = _item_0 | ||
| 1265 | _len_0 = _len_0 + 1 | ||
| 1266 | end | ||
| 1267 | return _accum_0 | ||
| 1268 | end)() | ||
| 1269 | end | ||
| 1270 | local start, last | ||
| 1271 | do | ||
| 1272 | local _obj_0 = orders | ||
| 1273 | start, last = (function() | ||
| 1274 | local _accum_0 = { } | ||
| 1275 | local _len_0 = 1 | ||
| 1276 | local _max_0 = #_obj_0 + -2 + 1 | ||
| 1277 | for _index_0 = 1, _max_0 do | ||
| 1278 | local _item_0 = _obj_0[_index_0] | ||
| 1279 | _accum_0[_len_0] = _item_0 | ||
| 1280 | _len_0 = _len_0 + 1 | ||
| 1281 | end | ||
| 1282 | return _accum_0 | ||
| 1283 | end)(), _obj_0[#_obj_0] | ||
| 1284 | end | ||
| 1285 | local _obj_0 = orders | ||
| 1286 | first, last = _obj_0[1], _obj_0[#_obj_0] | ||
| 1287 | local tuples = { | ||
| 1288 | { | ||
| 1289 | "hello", | ||
| 1290 | "world" | ||
| 1291 | }, | ||
| 1292 | { | ||
| 1293 | "egg", | ||
| 1294 | "head" | ||
| 1295 | } | ||
| 1296 | } | ||
| 1297 | for _index_0 = 1, #tuples do | ||
| 1298 | local _des_0 = tuples[_index_0] | ||
| 1299 | local left, right = _des_0[1], _des_0[2] | ||
| 1300 | print(left, right) | ||
| 1301 | end | ||
| 1302 | local thing = { | ||
| 1303 | 1, | ||
| 1304 | 2 | ||
| 1305 | } | ||
| 1306 | local a, b = thing[1], thing[2] | ||
| 1307 | print(a, b) | ||
| 1308 | local obj = { | ||
| 1309 | hello = "world", | ||
| 1310 | day = "tuesday", | ||
| 1311 | length = 20 | ||
| 1312 | } | ||
| 1313 | local hello, the_day = obj.hello, obj.day | ||
| 1314 | print(hello, the_day) | ||
| 1315 | local day = obj.day | ||
| 1316 | local obj2 = { | ||
| 1317 | numbers = { | ||
| 1318 | 1, | ||
| 1319 | 2, | ||
| 1320 | 3, | ||
| 1321 | 4 | ||
| 1322 | }, | ||
| 1323 | properties = { | ||
| 1324 | color = "green", | ||
| 1325 | height = 13.5 | ||
| 1326 | } | ||
| 1327 | } | ||
| 1328 | local first, second, color = obj2.numbers[1], obj2.numbers[2], obj2.properties.color | ||
| 1329 | print(first, second, color) | ||
| 1330 | local first, second, color | ||
| 1331 | local _obj_0 = obj2 | ||
| 1332 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color | ||
| 1333 | local concat, insert | ||
| 1334 | local _obj_0 = table | ||
| 1335 | concat, insert = _obj_0.concat, _obj_0.insert | ||
| 1336 | local mix, max, rand | ||
| 1337 | local _obj_0 = math | ||
| 1338 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random | ||
| 1339 | local name, job | ||
| 1340 | local _obj_0 = person | ||
| 1341 | name, job = _obj_0.name, _obj_0.job | ||
| 1342 | if name == nil then | ||
| 1343 | name = "nameless" | ||
| 1344 | end | ||
| 1345 | if job == nil then | ||
| 1346 | job = "jobless" | ||
| 1347 | end | ||
| 1348 | local two, four | ||
| 1349 | local _obj_0 = items | ||
| 1350 | two, four = _obj_0[2], _obj_0[4] | ||
| 1351 | local orders = { | ||
| 1352 | "first", | ||
| 1353 | "second", | ||
| 1354 | "third", | ||
| 1355 | "fourth", | ||
| 1356 | "last" | ||
| 1357 | } | ||
| 1358 | local first, bulk, last = orders[1], (function() | ||
| 1359 | local _accum_0 = { } | ||
| 1360 | local _len_0 = 1 | ||
| 1361 | local _max_0 = #orders + -2 + 1 | ||
| 1362 | for _index_0 = 2, _max_0 do | ||
| 1363 | local _item_0 = orders[_index_0] | ||
| 1364 | _accum_0[_len_0] = _item_0 | ||
| 1365 | _len_0 = _len_0 + 1 | ||
| 1366 | end | ||
| 1367 | return _accum_0 | ||
| 1368 | end)(), orders[#orders] | ||
| 1369 | print(first) | ||
| 1370 | print(bulk) | ||
| 1371 | print(last) | ||
| 1372 | local first, rest | ||
| 1373 | do | ||
| 1374 | local _obj_0 = orders | ||
| 1375 | first, rest = _obj_0[1], (function() | ||
| 1376 | local _accum_0 = { } | ||
| 1377 | local _len_0 = 1 | ||
| 1378 | local _max_0 = #_obj_0 | ||
| 1379 | for _index_0 = 2, _max_0 do | ||
| 1380 | local _item_0 = _obj_0[_index_0] | ||
| 1381 | _accum_0[_len_0] = _item_0 | ||
| 1382 | _len_0 = _len_0 + 1 | ||
| 1383 | end | ||
| 1384 | return _accum_0 | ||
| 1385 | end)() | ||
| 1386 | end | ||
| 1387 | local start, last | ||
| 1388 | do | ||
| 1389 | local _obj_0 = orders | ||
| 1390 | start, last = (function() | ||
| 1391 | local _accum_0 = { } | ||
| 1392 | local _len_0 = 1 | ||
| 1393 | local _max_0 = #_obj_0 + -2 + 1 | ||
| 1394 | for _index_0 = 1, _max_0 do | ||
| 1395 | local _item_0 = _obj_0[_index_0] | ||
| 1396 | _accum_0[_len_0] = _item_0 | ||
| 1397 | _len_0 = _len_0 + 1 | ||
| 1398 | end | ||
| 1399 | return _accum_0 | ||
| 1400 | end)(), _obj_0[#_obj_0] | ||
| 1401 | end | ||
| 1402 | local _obj_0 = orders | ||
| 1403 | first, last = _obj_0[1], _obj_0[#_obj_0] | ||
| 1404 | local tuples = { | ||
| 1405 | { | ||
| 1406 | "hello", | ||
| 1407 | "world" | ||
| 1408 | }, | ||
| 1409 | { | ||
| 1410 | "egg", | ||
| 1411 | "head" | ||
| 1412 | } | ||
| 1413 | } | ||
| 1414 | for _index_0 = 1, #tuples do | ||
| 1415 | local _des_0 = tuples[_index_0] | ||
| 1416 | local left, right = _des_0[1], _des_0[2] | ||
| 1417 | print(left, right) | ||
| 1418 | end | ||
| 1419 | local user = database.find_user("moon") | ||
| 1420 | if user then | ||
| 1421 | print(user.name) | ||
| 1422 | end | ||
| 1423 | local hello = os.getenv("hello") | ||
| 1424 | if hello then | ||
| 1425 | print("你有 hello", hello) | ||
| 1426 | else | ||
| 1427 | local world = os.getenv("world") | ||
| 1428 | if world then | ||
| 1429 | print("你有 world", world) | ||
| 1430 | else | ||
| 1431 | print("什么都没有 :(") | ||
| 1432 | end | ||
| 1433 | end | ||
| 1434 | do | ||
| 1435 | local success, result = pcall(function() | ||
| 1436 | return "无报错地获取结果" | ||
| 1437 | end) | ||
| 1438 | if success then | ||
| 1439 | print(result) | ||
| 1440 | end | ||
| 1441 | end | ||
| 1442 | print("好的") | ||
| 1443 | repeat | ||
| 1444 | local byte = stream:read_one() | ||
| 1445 | if byte then | ||
| 1446 | print(byte) | ||
| 1447 | else | ||
| 1448 | break | ||
| 1449 | end | ||
| 1450 | until false | ||
| 1451 | local user = database.find_user("moon") | ||
| 1452 | if user then | ||
| 1453 | print(user.name) | ||
| 1454 | end | ||
| 1455 | local hello = os.getenv("hello") | ||
| 1456 | if hello then | ||
| 1457 | print("你有 hello", hello) | ||
| 1458 | else | ||
| 1459 | local world = os.getenv("world") | ||
| 1460 | if world then | ||
| 1461 | print("你有 world", world) | ||
| 1462 | else | ||
| 1463 | print("什么都没有 :(") | ||
| 1464 | end | ||
| 1465 | end | ||
| 1466 | do | ||
| 1467 | local success, result = pcall(function() | ||
| 1468 | return "无报错地获取结果" | ||
| 1469 | end) | ||
| 1470 | if success then | ||
| 1471 | print(result) | ||
| 1472 | end | ||
| 1473 | end | ||
| 1474 | print("好的") | ||
| 1475 | repeat | ||
| 1476 | local byte = stream:read_one() | ||
| 1477 | if byte then | ||
| 1478 | print(byte) | ||
| 1479 | else | ||
| 1480 | break | ||
| 1481 | end | ||
| 1482 | until false | ||
| 1483 | local list = { | ||
| 1484 | 1, | ||
| 1485 | 2, | ||
| 1486 | 3, | ||
| 1487 | 4, | ||
| 1488 | 5 | ||
| 1489 | } | ||
| 1490 | local fn | ||
| 1491 | fn = function(ok) | ||
| 1492 | return ok, table.unpack(list) | ||
| 1493 | end | ||
| 1494 | (function(_arg_0, ...) | ||
| 1495 | local ok = _arg_0 | ||
| 1496 | local count = select('#', ...) | ||
| 1497 | local first = select(1, ...) | ||
| 1498 | return print(ok, count, first) | ||
| 1499 | end)(fn(true)) | ||
| 1500 | local list = { | ||
| 1501 | 1, | ||
| 1502 | 2, | ||
| 1503 | 3, | ||
| 1504 | 4, | ||
| 1505 | 5 | ||
| 1506 | } | ||
| 1507 | local fn | ||
| 1508 | fn = function(ok) | ||
| 1509 | return ok, table.unpack(list) | ||
| 1510 | end | ||
| 1511 | (function(_arg_0, ...) | ||
| 1512 | local ok = _arg_0 | ||
| 1513 | local count = select('#', ...) | ||
| 1514 | local first = select(1, ...) | ||
| 1515 | return print(ok, count, first) | ||
| 1516 | end)(fn(true)) | ||
| 1517 | local a = 1 | ||
| 1518 | local b = 2 | ||
| 1519 | print(a + b) | ||
| 1520 | Rx.Observable.fromRange(1, 8):filter(function(x) | ||
| 1521 | return x % 2 == 0 | ||
| 1522 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | ||
| 1523 | return value .. '!' | ||
| 1524 | end):subscribe(print) | ||
| 1525 | local a = 1 | ||
| 1526 | local b = 2 | ||
| 1527 | print(a + b) | ||
| 1528 | Rx.Observable.fromRange(1, 8):filter(function(x) | ||
| 1529 | return x % 2 == 0 | ||
| 1530 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | ||
| 1531 | return value .. '!' | ||
| 1532 | end):subscribe(print) | ||
| 1533 | local str = strA .. strB .. strC | ||
| 1534 | func(3000, "192.168.1.1") | ||
| 1535 | local str = strA .. strB .. strC | ||
| 1536 | func(3000, "192.168.1.1") | ||
| 1537 | xpcall(function() | 411 | xpcall(function() |
| 1538 | return func(1, 2, 3) | 412 | return func(1, 2, 3) |
| 1539 | end, function(err) | 413 | end, function(err) |
| @@ -1694,464 +568,6 @@ f((function() | |||
| 1694 | return e | 568 | return e |
| 1695 | end)) | 569 | end)) |
| 1696 | end)()) | 570 | end)()) |
| 1697 | local a <const> = 123 | ||
| 1698 | local _ <close> = setmetatable({ }, { | ||
| 1699 | __close = function() | ||
| 1700 | return print("超出范围。") | ||
| 1701 | end | ||
| 1702 | }) | ||
| 1703 | local a, b, c, d | ||
| 1704 | local _obj_0 = tb | ||
| 1705 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] | ||
| 1706 | Constant = 123 | ||
| 1707 | local a <const> = 123 | ||
| 1708 | local _ <close> = setmetatable({ }, { | ||
| 1709 | __close = function() | ||
| 1710 | return print("超出范围。") | ||
| 1711 | end | ||
| 1712 | }) | ||
| 1713 | local a, b, c, d | ||
| 1714 | local _obj_0 = tb | ||
| 1715 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] | ||
| 1716 | Constant = 123 | ||
| 1717 | local some_string = "这是一个字符串\n 并包括一个换行。" | ||
| 1718 | print("我有" .. tostring(math.random() * 100) .. "%的把握。") | ||
| 1719 | local integer = 1000000 | ||
| 1720 | local hex = 0xEFBBBF | ||
| 1721 | local binary = 19 | ||
| 1722 | local str = "key: value\nlist:\n - item1\n - " .. tostring(expr) | ||
| 1723 | local fn | ||
| 1724 | fn = function() | ||
| 1725 | local str = "foo:\n bar: baz" | ||
| 1726 | return str | ||
| 1727 | end | ||
| 1728 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | ||
| 1729 | local some_string = "这是一个字符串\n 并包括一个换行。" | ||
| 1730 | print("我有" .. tostring(math.random() * 100) .. "%的把握。") | ||
| 1731 | local integer = 1000000 | ||
| 1732 | local hex = 0xEFBBBF | ||
| 1733 | local binary = 19 | ||
| 1734 | local str = "key: value\nlist:\n - item1\n - " .. tostring(expr) | ||
| 1735 | local fn | ||
| 1736 | fn = function() | ||
| 1737 | local str = "foo:\n bar: baz" | ||
| 1738 | return str | ||
| 1739 | end | ||
| 1740 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | ||
| 1741 | local my_function | ||
| 1742 | my_function = function() end | ||
| 1743 | my_function() | ||
| 1744 | local func_a | ||
| 1745 | func_a = function() | ||
| 1746 | return print("你好,世界") | ||
| 1747 | end | ||
| 1748 | local func_b | ||
| 1749 | func_b = function() | ||
| 1750 | local value = 100 | ||
| 1751 | return print("这个值是:", value) | ||
| 1752 | end | ||
| 1753 | func_a() | ||
| 1754 | func_b() | ||
| 1755 | local sum | ||
| 1756 | sum = function(x, y) | ||
| 1757 | return print("数字的和", x + y) | ||
| 1758 | end | ||
| 1759 | sum(10, 20) | ||
| 1760 | print(sum(10, 20)) | ||
| 1761 | a(b(c("a", "b", "c"))) | ||
| 1762 | print("x:", sum(10, 20), "y:", sum(30, 40)) | ||
| 1763 | local sum | ||
| 1764 | sum = function(x, y) | ||
| 1765 | return x + y | ||
| 1766 | end | ||
| 1767 | print("数字的和是", sum(10, 20)) | ||
| 1768 | local sum | ||
| 1769 | sum = function(x, y) | ||
| 1770 | return x + y | ||
| 1771 | end | ||
| 1772 | local mystery | ||
| 1773 | mystery = function(x, y) | ||
| 1774 | return x + y, x - y | ||
| 1775 | end | ||
| 1776 | local a, b = mystery(10, 20) | ||
| 1777 | local func | ||
| 1778 | func = function(self, num) | ||
| 1779 | return self.value + num | ||
| 1780 | end | ||
| 1781 | local my_function | ||
| 1782 | my_function = function(name, height) | ||
| 1783 | if name == nil then | ||
| 1784 | name = "某物" | ||
| 1785 | end | ||
| 1786 | if height == nil then | ||
| 1787 | height = 100 | ||
| 1788 | end | ||
| 1789 | print("你好,我是", name) | ||
| 1790 | return print("我的高度是", height) | ||
| 1791 | end | ||
| 1792 | local some_args | ||
| 1793 | some_args = function(x, y) | ||
| 1794 | if x == nil then | ||
| 1795 | x = 100 | ||
| 1796 | end | ||
| 1797 | if y == nil then | ||
| 1798 | y = x + 1000 | ||
| 1799 | end | ||
| 1800 | return print(x + y) | ||
| 1801 | end | ||
| 1802 | local a = x - 10 | ||
| 1803 | local b = x - 10 | ||
| 1804 | local c = x(-y) | ||
| 1805 | local d = x - z | ||
| 1806 | local x = func("hello") + 100 | ||
| 1807 | local y = func("hello" + 100) | ||
| 1808 | my_func(5, 4, 3, 8, 9, 10) | ||
| 1809 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) | ||
| 1810 | my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) | ||
| 1811 | local x = { | ||
| 1812 | 1, | ||
| 1813 | 2, | ||
| 1814 | 3, | ||
| 1815 | 4, | ||
| 1816 | a_func(4, 5, 5, 6), | ||
| 1817 | 8, | ||
| 1818 | 9, | ||
| 1819 | 10 | ||
| 1820 | } | ||
| 1821 | local y = { | ||
| 1822 | my_func(1, 2, 3, 4, 5), | ||
| 1823 | 5, | ||
| 1824 | 6, | ||
| 1825 | 7 | ||
| 1826 | } | ||
| 1827 | if func(1, 2, 3, "你好", "世界") then | ||
| 1828 | print("你好") | ||
| 1829 | print("我在if内部") | ||
| 1830 | end | ||
| 1831 | if func(1, 2, 3, "你好", "世界") then | ||
| 1832 | print("hello") | ||
| 1833 | print("我在if内部") | ||
| 1834 | end | ||
| 1835 | local f1 | ||
| 1836 | f1 = function(_arg_0) | ||
| 1837 | local a, b, c | ||
| 1838 | a, b, c = _arg_0.a, _arg_0.b, _arg_0.c | ||
| 1839 | return print(a, b, c) | ||
| 1840 | end | ||
| 1841 | f1({ | ||
| 1842 | a = 1, | ||
| 1843 | b = "2", | ||
| 1844 | c = { } | ||
| 1845 | }) | ||
| 1846 | local f2 | ||
| 1847 | f2 = function(_arg_0, c) | ||
| 1848 | local a1, b | ||
| 1849 | a1, b = _arg_0.a, _arg_0.b | ||
| 1850 | if a1 == nil then | ||
| 1851 | a1 = 123 | ||
| 1852 | end | ||
| 1853 | if b == nil then | ||
| 1854 | b = 'abc' | ||
| 1855 | end | ||
| 1856 | if c == nil then | ||
| 1857 | c = { } | ||
| 1858 | end | ||
| 1859 | return print(a1, b, c) | ||
| 1860 | end | ||
| 1861 | local arg1 = { | ||
| 1862 | a = 0 | ||
| 1863 | } | ||
| 1864 | f2(arg1, arg2) | ||
| 1865 | local findFirstEven | ||
| 1866 | findFirstEven = function(list) | ||
| 1867 | for _index_0 = 1, #list do | ||
| 1868 | local item = list[_index_0] | ||
| 1869 | if type(item) == "table" then | ||
| 1870 | for _index_1 = 1, #item do | ||
| 1871 | local sub = item[_index_1] | ||
| 1872 | if sub % 2 == 0 then | ||
| 1873 | return sub | ||
| 1874 | end | ||
| 1875 | end | ||
| 1876 | end | ||
| 1877 | end | ||
| 1878 | return nil | ||
| 1879 | end | ||
| 1880 | local findFirstEven | ||
| 1881 | findFirstEven = function(list) | ||
| 1882 | for _index_0 = 1, #list do | ||
| 1883 | local item = list[_index_0] | ||
| 1884 | if type(item) == "table" then | ||
| 1885 | for _index_1 = 1, #item do | ||
| 1886 | local sub = item[_index_1] | ||
| 1887 | if sub % 2 == 0 then | ||
| 1888 | return sub | ||
| 1889 | end | ||
| 1890 | end | ||
| 1891 | end | ||
| 1892 | end | ||
| 1893 | return nil | ||
| 1894 | end | ||
| 1895 | local f | ||
| 1896 | f = function(...) | ||
| 1897 | local t = { | ||
| 1898 | n = select("#", ...), | ||
| 1899 | ... | ||
| 1900 | } | ||
| 1901 | print("参数个数:", t.n) | ||
| 1902 | print("表长度:", #t) | ||
| 1903 | for i = 1, t.n do | ||
| 1904 | print(t[i]) | ||
| 1905 | end | ||
| 1906 | end | ||
| 1907 | f(1, 2, 3) | ||
| 1908 | f("a", "b", "c", "d") | ||
| 1909 | f() | ||
| 1910 | local process | ||
| 1911 | process = function(...) | ||
| 1912 | local args = { | ||
| 1913 | n = select("#", ...), | ||
| 1914 | ... | ||
| 1915 | } | ||
| 1916 | local sum = 0 | ||
| 1917 | for i = 1, args.n do | ||
| 1918 | if args[i] ~= nil and type(args[i]) == "number" then | ||
| 1919 | sum = sum + args[i] | ||
| 1920 | end | ||
| 1921 | end | ||
| 1922 | return sum | ||
| 1923 | end | ||
| 1924 | process(1, nil, 3, nil, 5) | ||
| 1925 | local my_function | ||
| 1926 | my_function = function() end | ||
| 1927 | my_function() | ||
| 1928 | local func_a | ||
| 1929 | func_a = function() | ||
| 1930 | return print("你好,世界") | ||
| 1931 | end | ||
| 1932 | local func_b | ||
| 1933 | func_b = function() | ||
| 1934 | local value = 100 | ||
| 1935 | return print("这个值是:", value) | ||
| 1936 | end | ||
| 1937 | func_a() | ||
| 1938 | func_b() | ||
| 1939 | local sum | ||
| 1940 | sum = function(x, y) | ||
| 1941 | return print("数字的和", x + y) | ||
| 1942 | end | ||
| 1943 | sum(10, 20) | ||
| 1944 | print(sum(10, 20)) | ||
| 1945 | a(b(c("a", "b", "c"))) | ||
| 1946 | print("x:", sum(10, 20), "y:", sum(30, 40)) | ||
| 1947 | local sum | ||
| 1948 | sum = function(x, y) | ||
| 1949 | return x + y | ||
| 1950 | end | ||
| 1951 | print("数字的和是", sum(10, 20)) | ||
| 1952 | local sum | ||
| 1953 | sum = function(x, y) | ||
| 1954 | return x + y | ||
| 1955 | end | ||
| 1956 | local mystery | ||
| 1957 | mystery = function(x, y) | ||
| 1958 | return x + y, x - y | ||
| 1959 | end | ||
| 1960 | local a, b = mystery(10, 20) | ||
| 1961 | local func | ||
| 1962 | func = function(self, num) | ||
| 1963 | return self.value + num | ||
| 1964 | end | ||
| 1965 | local my_function | ||
| 1966 | my_function = function(name, height) | ||
| 1967 | if name == nil then | ||
| 1968 | name = "某物" | ||
| 1969 | end | ||
| 1970 | if height == nil then | ||
| 1971 | height = 100 | ||
| 1972 | end | ||
| 1973 | print("你好,我是", name) | ||
| 1974 | return print("我的高度是", height) | ||
| 1975 | end | ||
| 1976 | local some_args | ||
| 1977 | some_args = function(x, y) | ||
| 1978 | if x == nil then | ||
| 1979 | x = 100 | ||
| 1980 | end | ||
| 1981 | if y == nil then | ||
| 1982 | y = x + 1000 | ||
| 1983 | end | ||
| 1984 | return print(x + y) | ||
| 1985 | end | ||
| 1986 | local a = x - 10 | ||
| 1987 | local b = x - 10 | ||
| 1988 | local c = x(-y) | ||
| 1989 | local d = x - z | ||
| 1990 | local x = func("hello") + 100 | ||
| 1991 | local y = func("hello" + 100) | ||
| 1992 | my_func(5, 4, 3, 8, 9, 10) | ||
| 1993 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) | ||
| 1994 | my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) | ||
| 1995 | local x = { | ||
| 1996 | 1, | ||
| 1997 | 2, | ||
| 1998 | 3, | ||
| 1999 | 4, | ||
| 2000 | a_func(4, 5, 5, 6), | ||
| 2001 | 8, | ||
| 2002 | 9, | ||
| 2003 | 10 | ||
| 2004 | } | ||
| 2005 | local y = { | ||
| 2006 | my_func(1, 2, 3, 4, 5), | ||
| 2007 | 5, | ||
| 2008 | 6, | ||
| 2009 | 7 | ||
| 2010 | } | ||
| 2011 | if func(1, 2, 3, "你好", "世界") then | ||
| 2012 | print("你好") | ||
| 2013 | print("我在if内部") | ||
| 2014 | end | ||
| 2015 | if func(1, 2, 3, "你好", "世界") then | ||
| 2016 | print("你好") | ||
| 2017 | print("我在if内部") | ||
| 2018 | end | ||
| 2019 | local f1 | ||
| 2020 | f1 = function(_arg_0) | ||
| 2021 | local a, b, c | ||
| 2022 | a, b, c = _arg_0.a, _arg_0.b, _arg_0.c | ||
| 2023 | return print(a, b, c) | ||
| 2024 | end | ||
| 2025 | f1({ | ||
| 2026 | a = 1, | ||
| 2027 | b = "2", | ||
| 2028 | c = { } | ||
| 2029 | }) | ||
| 2030 | local f2 | ||
| 2031 | f2 = function(_arg_0, c) | ||
| 2032 | local a1, b | ||
| 2033 | a1, b = _arg_0.a, _arg_0.b | ||
| 2034 | if a1 == nil then | ||
| 2035 | a1 = 123 | ||
| 2036 | end | ||
| 2037 | if b == nil then | ||
| 2038 | b = 'abc' | ||
| 2039 | end | ||
| 2040 | if c == nil then | ||
| 2041 | c = { } | ||
| 2042 | end | ||
| 2043 | return print(a1, b, c) | ||
| 2044 | end | ||
| 2045 | local arg1 = { | ||
| 2046 | a = 0 | ||
| 2047 | } | ||
| 2048 | f2(arg1, arg2) | ||
| 2049 | local findFirstEven | ||
| 2050 | findFirstEven = function(list) | ||
| 2051 | for _index_0 = 1, #list do | ||
| 2052 | local item = list[_index_0] | ||
| 2053 | if type(item) == "table" then | ||
| 2054 | for _index_1 = 1, #item do | ||
| 2055 | local sub = item[_index_1] | ||
| 2056 | if sub % 2 == 0 then | ||
| 2057 | return sub | ||
| 2058 | end | ||
| 2059 | end | ||
| 2060 | end | ||
| 2061 | end | ||
| 2062 | return nil | ||
| 2063 | end | ||
| 2064 | local findFirstEven | ||
| 2065 | findFirstEven = function(list) | ||
| 2066 | for _index_0 = 1, #list do | ||
| 2067 | local item = list[_index_0] | ||
| 2068 | if type(item) == "table" then | ||
| 2069 | for _index_1 = 1, #item do | ||
| 2070 | local sub = item[_index_1] | ||
| 2071 | if sub % 2 == 0 then | ||
| 2072 | return sub | ||
| 2073 | end | ||
| 2074 | end | ||
| 2075 | end | ||
| 2076 | end | ||
| 2077 | return nil | ||
| 2078 | end | ||
| 2079 | local f | ||
| 2080 | f = function(...) | ||
| 2081 | local t = { | ||
| 2082 | n = select("#", ...), | ||
| 2083 | ... | ||
| 2084 | } | ||
| 2085 | print("参数个数:", t.n) | ||
| 2086 | print("表长度:", #t) | ||
| 2087 | for i = 1, t.n do | ||
| 2088 | print(t[i]) | ||
| 2089 | end | ||
| 2090 | end | ||
| 2091 | f(1, 2, 3) | ||
| 2092 | f("a", "b", "c", "d") | ||
| 2093 | f() | ||
| 2094 | local process | ||
| 2095 | process = function(...) | ||
| 2096 | local args = { | ||
| 2097 | n = select("#", ...), | ||
| 2098 | ... | ||
| 2099 | } | ||
| 2100 | local sum = 0 | ||
| 2101 | for i = 1, args.n do | ||
| 2102 | if args[i] ~= nil and type(args[i]) == "number" then | ||
| 2103 | sum = sum + args[i] | ||
| 2104 | end | ||
| 2105 | end | ||
| 2106 | return sum | ||
| 2107 | end | ||
| 2108 | process(1, nil, 3, nil, 5) | ||
| 2109 | f(function(x) | ||
| 2110 | return print("hello" .. x) | ||
| 2111 | end) | ||
| 2112 | f(function(self) | ||
| 2113 | return print(self.value) | ||
| 2114 | end) | ||
| 2115 | map(function(x) | ||
| 2116 | return x * 2 | ||
| 2117 | end, { | ||
| 2118 | 1, | ||
| 2119 | 2, | ||
| 2120 | 3 | ||
| 2121 | }) | ||
| 2122 | local result, msg | ||
| 2123 | do | ||
| 2124 | result, msg = readAsync("文件名.txt", function(data) | ||
| 2125 | print(data) | ||
| 2126 | return processAsync(data, function(info) | ||
| 2127 | return check(info) | ||
| 2128 | end) | ||
| 2129 | end) | ||
| 2130 | end | ||
| 2131 | print(result, msg) | ||
| 2132 | f(function(x) | ||
| 2133 | return print("hello" .. x) | ||
| 2134 | end) | ||
| 2135 | f(function(self) | ||
| 2136 | return print(self.value) | ||
| 2137 | end) | ||
| 2138 | map(function(x) | ||
| 2139 | return x * 2 | ||
| 2140 | end, { | ||
| 2141 | 1, | ||
| 2142 | 2, | ||
| 2143 | 3 | ||
| 2144 | }) | ||
| 2145 | local result, msg | ||
| 2146 | do | ||
| 2147 | result, msg = readAsync("文件名.txt", function(data) | ||
| 2148 | print(data) | ||
| 2149 | return processAsync(data, function(info) | ||
| 2150 | return check(info) | ||
| 2151 | end) | ||
| 2152 | end) | ||
| 2153 | end | ||
| 2154 | print(result, msg) | ||
| 2155 | local some_values = { | 571 | local some_values = { |
| 2156 | 1, | 572 | 1, |
| 2157 | 2, | 573 | 2, |
| @@ -2730,966 +1146,6 @@ for _index_0 = _min_0, _max_0 do | |||
| 2730 | _len_0 = _len_0 + 1 | 1146 | _len_0 = _len_0 + 1 |
| 2731 | end | 1147 | end |
| 2732 | last_four_items = _accum_0 | 1148 | last_four_items = _accum_0 |
| 2733 | for i = 10, 20 do | ||
| 2734 | print(i) | ||
| 2735 | end | ||
| 2736 | for k = 1, 15, 2 do | ||
| 2737 | print(k) | ||
| 2738 | end | ||
| 2739 | for key, value in pairs(object) do | ||
| 2740 | print(key, value) | ||
| 2741 | end | ||
| 2742 | local _list_0 = items | ||
| 2743 | for _index_0 = 2, 4 do | ||
| 2744 | local item = _list_0[_index_0] | ||
| 2745 | print(item) | ||
| 2746 | end | ||
| 2747 | local _list_0 = items | ||
| 2748 | for _index_0 = 1, #_list_0 do | ||
| 2749 | local item = _list_0[_index_0] | ||
| 2750 | print(item) | ||
| 2751 | end | ||
| 2752 | for j = 1, 10, 3 do | ||
| 2753 | print(j) | ||
| 2754 | end | ||
| 2755 | local doubled_evens | ||
| 2756 | local _accum_0 = { } | ||
| 2757 | local _len_0 = 1 | ||
| 2758 | for i = 1, 20 do | ||
| 2759 | if i % 2 == 0 then | ||
| 2760 | _accum_0[_len_0] = i * 2 | ||
| 2761 | _len_0 = _len_0 + 1 | ||
| 2762 | else | ||
| 2763 | _accum_0[_len_0] = i | ||
| 2764 | _len_0 = _len_0 + 1 | ||
| 2765 | end | ||
| 2766 | end | ||
| 2767 | doubled_evens = _accum_0 | ||
| 2768 | local first_large | ||
| 2769 | local _accum_0 | ||
| 2770 | local _list_0 = numbers | ||
| 2771 | for _index_0 = 1, #_list_0 do | ||
| 2772 | local n = _list_0[_index_0] | ||
| 2773 | if n > 10 then | ||
| 2774 | _accum_0 = n | ||
| 2775 | break | ||
| 2776 | end | ||
| 2777 | end | ||
| 2778 | first_large = _accum_0 | ||
| 2779 | local func_a | ||
| 2780 | func_a = function() | ||
| 2781 | for i = 1, 10 do | ||
| 2782 | print(i) | ||
| 2783 | end | ||
| 2784 | end | ||
| 2785 | local func_b | ||
| 2786 | func_b = function() | ||
| 2787 | local _accum_0 = { } | ||
| 2788 | local _len_0 = 1 | ||
| 2789 | for i = 1, 10 do | ||
| 2790 | _accum_0[_len_0] = i | ||
| 2791 | _len_0 = _len_0 + 1 | ||
| 2792 | end | ||
| 2793 | return _accum_0 | ||
| 2794 | end | ||
| 2795 | print(func_a()) | ||
| 2796 | print(func_b()) | ||
| 2797 | for i = 10, 20 do | ||
| 2798 | print(i) | ||
| 2799 | end | ||
| 2800 | for k = 1, 15, 2 do | ||
| 2801 | print(k) | ||
| 2802 | end | ||
| 2803 | for key, value in pairs(object) do | ||
| 2804 | print(key, value) | ||
| 2805 | end | ||
| 2806 | local _list_0 = items | ||
| 2807 | for _index_0 = 2, 4 do | ||
| 2808 | local item = _list_0[_index_0] | ||
| 2809 | print(item) | ||
| 2810 | end | ||
| 2811 | local _list_0 = items | ||
| 2812 | for _index_0 = 1, #_list_0 do | ||
| 2813 | local item = _list_0[_index_0] | ||
| 2814 | print(item) | ||
| 2815 | end | ||
| 2816 | for j = 1, 10, 3 do | ||
| 2817 | print(j) | ||
| 2818 | end | ||
| 2819 | local doubled_evens | ||
| 2820 | local _accum_0 = { } | ||
| 2821 | local _len_0 = 1 | ||
| 2822 | for i = 1, 20 do | ||
| 2823 | if i % 2 == 0 then | ||
| 2824 | _accum_0[_len_0] = i * 2 | ||
| 2825 | _len_0 = _len_0 + 1 | ||
| 2826 | else | ||
| 2827 | _accum_0[_len_0] = i | ||
| 2828 | _len_0 = _len_0 + 1 | ||
| 2829 | end | ||
| 2830 | end | ||
| 2831 | doubled_evens = _accum_0 | ||
| 2832 | local first_large | ||
| 2833 | local _accum_0 | ||
| 2834 | local _list_0 = numbers | ||
| 2835 | for _index_0 = 1, #_list_0 do | ||
| 2836 | local n = _list_0[_index_0] | ||
| 2837 | if n > 10 then | ||
| 2838 | _accum_0 = n | ||
| 2839 | break | ||
| 2840 | end | ||
| 2841 | end | ||
| 2842 | first_large = _accum_0 | ||
| 2843 | local func_a | ||
| 2844 | func_a = function() | ||
| 2845 | for i = 1, 10 do | ||
| 2846 | print(i) | ||
| 2847 | end | ||
| 2848 | end | ||
| 2849 | local func_b | ||
| 2850 | func_b = function() | ||
| 2851 | local _accum_0 = { } | ||
| 2852 | local _len_0 = 1 | ||
| 2853 | for i = 1, 10 do | ||
| 2854 | _accum_0[_len_0] = i | ||
| 2855 | _len_0 = _len_0 + 1 | ||
| 2856 | end | ||
| 2857 | return _accum_0 | ||
| 2858 | end | ||
| 2859 | print(func_a()) | ||
| 2860 | print(func_b()) | ||
| 2861 | local i = 10 | ||
| 2862 | while i > 0 do | ||
| 2863 | print(i) | ||
| 2864 | i = i - 1 | ||
| 2865 | end | ||
| 2866 | while running == true do | ||
| 2867 | my_function() | ||
| 2868 | end | ||
| 2869 | local i = 10 | ||
| 2870 | while not (i == 0) do | ||
| 2871 | print(i) | ||
| 2872 | i = i - 1 | ||
| 2873 | end | ||
| 2874 | while not (running == false) do | ||
| 2875 | my_function() | ||
| 2876 | end | ||
| 2877 | local i = 10 | ||
| 2878 | repeat | ||
| 2879 | print(i) | ||
| 2880 | i = i - 1 | ||
| 2881 | until i == 0 | ||
| 2882 | local i = 10 | ||
| 2883 | while i > 0 do | ||
| 2884 | print(i) | ||
| 2885 | i = i - 1 | ||
| 2886 | end | ||
| 2887 | while running == true do | ||
| 2888 | my_function() | ||
| 2889 | end | ||
| 2890 | local i = 10 | ||
| 2891 | while not (i == 0) do | ||
| 2892 | print(i) | ||
| 2893 | i = i - 1 | ||
| 2894 | end | ||
| 2895 | while not (running == false) do | ||
| 2896 | my_function() | ||
| 2897 | end | ||
| 2898 | local i = 10 | ||
| 2899 | repeat | ||
| 2900 | print(i) | ||
| 2901 | i = i - 1 | ||
| 2902 | until i == 0 | ||
| 2903 | local i = 0 | ||
| 2904 | while i < 10 do | ||
| 2905 | i = i + 1 | ||
| 2906 | if i % 2 == 0 then | ||
| 2907 | goto _continue_0 | ||
| 2908 | end | ||
| 2909 | print(i) | ||
| 2910 | ::_continue_0:: | ||
| 2911 | end | ||
| 2912 | local my_numbers = { | ||
| 2913 | 1, | ||
| 2914 | 2, | ||
| 2915 | 3, | ||
| 2916 | 4, | ||
| 2917 | 5, | ||
| 2918 | 6 | ||
| 2919 | } | ||
| 2920 | local odds | ||
| 2921 | local _accum_0 = { } | ||
| 2922 | local _len_0 = 1 | ||
| 2923 | for _index_0 = 1, #my_numbers do | ||
| 2924 | local x = my_numbers[_index_0] | ||
| 2925 | if x % 2 == 1 then | ||
| 2926 | goto _continue_0 | ||
| 2927 | end | ||
| 2928 | _accum_0[_len_0] = x | ||
| 2929 | _len_0 = _len_0 + 1 | ||
| 2930 | ::_continue_0:: | ||
| 2931 | end | ||
| 2932 | odds = _accum_0 | ||
| 2933 | local i = 0 | ||
| 2934 | while i < 10 do | ||
| 2935 | i = i + 1 | ||
| 2936 | if i % 2 == 0 then | ||
| 2937 | goto _continue_0 | ||
| 2938 | end | ||
| 2939 | print(i) | ||
| 2940 | ::_continue_0:: | ||
| 2941 | end | ||
| 2942 | local my_numbers = { | ||
| 2943 | 1, | ||
| 2944 | 2, | ||
| 2945 | 3, | ||
| 2946 | 4, | ||
| 2947 | 5, | ||
| 2948 | 6 | ||
| 2949 | } | ||
| 2950 | local odds | ||
| 2951 | local _accum_0 = { } | ||
| 2952 | local _len_0 = 1 | ||
| 2953 | for _index_0 = 1, #my_numbers do | ||
| 2954 | local x = my_numbers[_index_0] | ||
| 2955 | if x % 2 == 1 then | ||
| 2956 | goto _continue_0 | ||
| 2957 | end | ||
| 2958 | _accum_0[_len_0] = x | ||
| 2959 | _len_0 = _len_0 + 1 | ||
| 2960 | ::_continue_0:: | ||
| 2961 | end | ||
| 2962 | odds = _accum_0 | ||
| 2963 | local have_coins = false | ||
| 2964 | if have_coins then | ||
| 2965 | print("有硬币") | ||
| 2966 | else | ||
| 2967 | print("没有硬币") | ||
| 2968 | end | ||
| 2969 | local have_coins = false | ||
| 2970 | if have_coins then | ||
| 2971 | print("有硬币") | ||
| 2972 | else | ||
| 2973 | print("没有硬币") | ||
| 2974 | end | ||
| 2975 | local have_coins = false | ||
| 2976 | print((function() | ||
| 2977 | if have_coins then | ||
| 2978 | return "有硬币" | ||
| 2979 | else | ||
| 2980 | return "没有硬币" | ||
| 2981 | end | ||
| 2982 | end)()) | ||
| 2983 | local is_tall | ||
| 2984 | is_tall = function(name) | ||
| 2985 | if name == "Rob" then | ||
| 2986 | return true | ||
| 2987 | else | ||
| 2988 | return false | ||
| 2989 | end | ||
| 2990 | end | ||
| 2991 | local message | ||
| 2992 | if is_tall("Rob") then | ||
| 2993 | message = "我很高" | ||
| 2994 | else | ||
| 2995 | message = "我不是很高" | ||
| 2996 | end | ||
| 2997 | print(message) | ||
| 2998 | if not (os.date("%A") == "Monday") then | ||
| 2999 | print("今天不是星期一!") | ||
| 3000 | end | ||
| 3001 | if not (math.random() > 0.1) then | ||
| 3002 | print("你真幸运!") | ||
| 3003 | end | ||
| 3004 | local a = 5 | ||
| 3005 | if (1 == a or 3 == a or 5 == a or 7 == a) then | ||
| 3006 | print("检查离散值的相等性") | ||
| 3007 | end | ||
| 3008 | if (function() | ||
| 3009 | local _check_0 = list | ||
| 3010 | for _index_0 = 1, #_check_0 do | ||
| 3011 | if _check_0[_index_0] == a then | ||
| 3012 | return true | ||
| 3013 | end | ||
| 3014 | end | ||
| 3015 | return false | ||
| 3016 | end)() then | ||
| 3017 | print("检查`a`是否在列表中") | ||
| 3018 | end | ||
| 3019 | if not (math.random() > 0.1) then | ||
| 3020 | print("你很幸运!") | ||
| 3021 | end | ||
| 3022 | local have_coins = false | ||
| 3023 | if have_coins then | ||
| 3024 | print("有硬币") | ||
| 3025 | else | ||
| 3026 | print("没有硬币") | ||
| 3027 | end | ||
| 3028 | local have_coins = false | ||
| 3029 | if have_coins then | ||
| 3030 | print("有硬币") | ||
| 3031 | else | ||
| 3032 | print("没有硬币") | ||
| 3033 | end | ||
| 3034 | local have_coins = false | ||
| 3035 | print((function() | ||
| 3036 | if have_coins then | ||
| 3037 | return "有硬币" | ||
| 3038 | else | ||
| 3039 | return "没有硬币" | ||
| 3040 | end | ||
| 3041 | end)()) | ||
| 3042 | local is_tall | ||
| 3043 | is_tall = function(name) | ||
| 3044 | if name == "Rob" then | ||
| 3045 | return true | ||
| 3046 | else | ||
| 3047 | return false | ||
| 3048 | end | ||
| 3049 | end | ||
| 3050 | local message | ||
| 3051 | if is_tall("Rob") then | ||
| 3052 | message = "我很高" | ||
| 3053 | else | ||
| 3054 | message = "我不是很高" | ||
| 3055 | end | ||
| 3056 | print(message) | ||
| 3057 | if not (os.date("%A") == "Monday") then | ||
| 3058 | print("今天不是星期一!") | ||
| 3059 | end | ||
| 3060 | if not (math.random() > 0.1) then | ||
| 3061 | print("你真幸运!") | ||
| 3062 | end | ||
| 3063 | local a = 5 | ||
| 3064 | if (1 == a or 3 == a or 5 == a or 7 == a) then | ||
| 3065 | print("检查离散值的相等性") | ||
| 3066 | end | ||
| 3067 | if (function() | ||
| 3068 | local _check_0 = list | ||
| 3069 | for _index_0 = 1, #_check_0 do | ||
| 3070 | if _check_0[_index_0] == a then | ||
| 3071 | return true | ||
| 3072 | end | ||
| 3073 | end | ||
| 3074 | return false | ||
| 3075 | end)() then | ||
| 3076 | print("检查`a`是否在列表中") | ||
| 3077 | end | ||
| 3078 | if not (math.random() > 0.1) then | ||
| 3079 | print("你很幸运!") | ||
| 3080 | end | ||
| 3081 | if name == "Rob" then | ||
| 3082 | print("你好,世界") | ||
| 3083 | end | ||
| 3084 | local _list_0 = items | ||
| 3085 | for _index_0 = 1, #_list_0 do | ||
| 3086 | local item = _list_0[_index_0] | ||
| 3087 | print("项目: ", item) | ||
| 3088 | end | ||
| 3089 | while game:isRunning() do | ||
| 3090 | game:update() | ||
| 3091 | end | ||
| 3092 | while not reader:eof() do | ||
| 3093 | reader:parse_line() | ||
| 3094 | end | ||
| 3095 | if name == "Rob" then | ||
| 3096 | print("你好,世界") | ||
| 3097 | end | ||
| 3098 | local _list_0 = items | ||
| 3099 | for _index_0 = 1, #_list_0 do | ||
| 3100 | local item = _list_0[_index_0] | ||
| 3101 | print("项目: ", item) | ||
| 3102 | end | ||
| 3103 | while game:isRunning() do | ||
| 3104 | game:update() | ||
| 3105 | end | ||
| 3106 | while not reader:eof() do | ||
| 3107 | reader:parse_line() | ||
| 3108 | end | ||
| 3109 | local name = "Dan" | ||
| 3110 | if "Robert" == name then | ||
| 3111 | print("你是Robert") | ||
| 3112 | elseif "Dan" == name or "Daniel" == name then | ||
| 3113 | print("你的名字是Dan") | ||
| 3114 | else | ||
| 3115 | print("我不认识你,你的名字是" .. tostring(name)) | ||
| 3116 | end | ||
| 3117 | local b = 1 | ||
| 3118 | local next_number | ||
| 3119 | if 1 == b then | ||
| 3120 | next_number = 2 | ||
| 3121 | elseif 2 == b then | ||
| 3122 | next_number = 3 | ||
| 3123 | else | ||
| 3124 | next_number = error("数字数得太大了!") | ||
| 3125 | end | ||
| 3126 | local msg | ||
| 3127 | local _exp_0 = math.random(1, 5) | ||
| 3128 | if 1 == _exp_0 then | ||
| 3129 | msg = "你很幸运" | ||
| 3130 | elseif 2 == _exp_0 then | ||
| 3131 | msg = "你差点很幸运" | ||
| 3132 | else | ||
| 3133 | msg = "不太幸运" | ||
| 3134 | end | ||
| 3135 | do | ||
| 3136 | local _exp_0 = math.random(1, 5) | ||
| 3137 | if 1 == _exp_0 then | ||
| 3138 | print("你很幸运") | ||
| 3139 | else | ||
| 3140 | print("不太幸运") | ||
| 3141 | end | ||
| 3142 | end | ||
| 3143 | local _exp_0 = math.random(1, 5) | ||
| 3144 | if 1 == _exp_0 then | ||
| 3145 | print("你很幸运") | ||
| 3146 | else | ||
| 3147 | print("不太幸运") | ||
| 3148 | end | ||
| 3149 | local items = { | ||
| 3150 | { | ||
| 3151 | x = 100, | ||
| 3152 | y = 200 | ||
| 3153 | }, | ||
| 3154 | { | ||
| 3155 | width = 300, | ||
| 3156 | height = 400 | ||
| 3157 | } | ||
| 3158 | } | ||
| 3159 | for _index_0 = 1, #items do | ||
| 3160 | local item = items[_index_0] | ||
| 3161 | local _type_0 = type(item) | ||
| 3162 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3163 | local _match_0 = false | ||
| 3164 | if _tab_0 then | ||
| 3165 | local x = item.x | ||
| 3166 | local y = item.y | ||
| 3167 | if x ~= nil and y ~= nil then | ||
| 3168 | _match_0 = true | ||
| 3169 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3170 | end | ||
| 3171 | end | ||
| 3172 | if not _match_0 then | ||
| 3173 | if _tab_0 then | ||
| 3174 | local width = item.width | ||
| 3175 | local height = item.height | ||
| 3176 | if width ~= nil and height ~= nil then | ||
| 3177 | print("尺寸 " .. tostring(width) .. ", " .. tostring(height)) | ||
| 3178 | end | ||
| 3179 | end | ||
| 3180 | end | ||
| 3181 | end | ||
| 3182 | local item = { } | ||
| 3183 | local x, y = item.pos.x, item.pos.y | ||
| 3184 | if x == nil then | ||
| 3185 | x = 50 | ||
| 3186 | end | ||
| 3187 | if y == nil then | ||
| 3188 | y = 200 | ||
| 3189 | end | ||
| 3190 | local _type_0 = type(item) | ||
| 3191 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3192 | if _tab_0 then | ||
| 3193 | do | ||
| 3194 | local _obj_0 = item.pos | ||
| 3195 | local _type_1 = type(_obj_0) | ||
| 3196 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3197 | x = _obj_0.x | ||
| 3198 | end | ||
| 3199 | end | ||
| 3200 | do | ||
| 3201 | local _obj_0 = item.pos | ||
| 3202 | local _type_1 = type(_obj_0) | ||
| 3203 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3204 | y = _obj_0.y | ||
| 3205 | end | ||
| 3206 | end | ||
| 3207 | if x == nil then | ||
| 3208 | x = 50 | ||
| 3209 | end | ||
| 3210 | if y == nil then | ||
| 3211 | y = 200 | ||
| 3212 | end | ||
| 3213 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3214 | end | ||
| 3215 | local _exp_0 = tb | ||
| 3216 | local _type_0 = type(_exp_0) | ||
| 3217 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3218 | local _match_0 = false | ||
| 3219 | if _tab_0 then | ||
| 3220 | if 1 == _exp_0[1] and 2 == _exp_0[2] and 3 == _exp_0[3] then | ||
| 3221 | _match_0 = true | ||
| 3222 | print("1, 2, 3") | ||
| 3223 | end | ||
| 3224 | end | ||
| 3225 | if not _match_0 then | ||
| 3226 | local _match_1 = false | ||
| 3227 | if _tab_0 then | ||
| 3228 | local b = _exp_0[2] | ||
| 3229 | if 1 == _exp_0[1] and b ~= nil and 3 == _exp_0[3] then | ||
| 3230 | _match_1 = true | ||
| 3231 | print("1, " .. tostring(b) .. ", 3") | ||
| 3232 | end | ||
| 3233 | end | ||
| 3234 | if not _match_1 then | ||
| 3235 | if _tab_0 then | ||
| 3236 | local b = _exp_0[3] | ||
| 3237 | if b == nil then | ||
| 3238 | b = 3 | ||
| 3239 | end | ||
| 3240 | if 1 == _exp_0[1] and 2 == _exp_0[2] then | ||
| 3241 | print("1, 2, " .. tostring(b)) | ||
| 3242 | end | ||
| 3243 | end | ||
| 3244 | end | ||
| 3245 | end | ||
| 3246 | local _exp_0 = tb | ||
| 3247 | local _type_0 = type(_exp_0) | ||
| 3248 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3249 | local _match_0 = false | ||
| 3250 | if _tab_0 then | ||
| 3251 | local result = _exp_0.result | ||
| 3252 | if true == _exp_0.success and result ~= nil then | ||
| 3253 | _match_0 = true | ||
| 3254 | print("成功", result) | ||
| 3255 | end | ||
| 3256 | end | ||
| 3257 | if not _match_0 then | ||
| 3258 | local _match_1 = false | ||
| 3259 | if _tab_0 then | ||
| 3260 | if false == _exp_0.success then | ||
| 3261 | _match_1 = true | ||
| 3262 | print("失败", result) | ||
| 3263 | end | ||
| 3264 | end | ||
| 3265 | if not _match_1 then | ||
| 3266 | print("无效值") | ||
| 3267 | end | ||
| 3268 | end | ||
| 3269 | local _exp_0 = tb | ||
| 3270 | local _type_0 = type(_exp_0) | ||
| 3271 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3272 | local _match_0 = false | ||
| 3273 | if _tab_0 then | ||
| 3274 | local content | ||
| 3275 | do | ||
| 3276 | local _obj_0 = _exp_0.data | ||
| 3277 | local _type_1 = type(_obj_0) | ||
| 3278 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3279 | content = _obj_0.content | ||
| 3280 | end | ||
| 3281 | end | ||
| 3282 | local _val_0 | ||
| 3283 | do | ||
| 3284 | local _obj_0 = _exp_0.data | ||
| 3285 | if _obj_0 ~= nil then | ||
| 3286 | _val_0 = _obj_0.type | ||
| 3287 | end | ||
| 3288 | end | ||
| 3289 | if "success" == _val_0 and content ~= nil then | ||
| 3290 | _match_0 = true | ||
| 3291 | print("成功", content) | ||
| 3292 | end | ||
| 3293 | end | ||
| 3294 | if not _match_0 then | ||
| 3295 | local _match_1 = false | ||
| 3296 | if _tab_0 then | ||
| 3297 | local content | ||
| 3298 | do | ||
| 3299 | local _obj_0 = _exp_0.data | ||
| 3300 | local _type_1 = type(_obj_0) | ||
| 3301 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3302 | content = _obj_0.content | ||
| 3303 | end | ||
| 3304 | end | ||
| 3305 | local _val_0 | ||
| 3306 | do | ||
| 3307 | local _obj_0 = _exp_0.data | ||
| 3308 | if _obj_0 ~= nil then | ||
| 3309 | _val_0 = _obj_0.type | ||
| 3310 | end | ||
| 3311 | end | ||
| 3312 | if "error" == _val_0 and content ~= nil then | ||
| 3313 | _match_1 = true | ||
| 3314 | print("失败", content) | ||
| 3315 | end | ||
| 3316 | end | ||
| 3317 | if not _match_1 then | ||
| 3318 | print("无效值") | ||
| 3319 | end | ||
| 3320 | end | ||
| 3321 | local _exp_0 = tb | ||
| 3322 | local _type_0 = type(_exp_0) | ||
| 3323 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3324 | if _tab_0 then | ||
| 3325 | local fourth = _exp_0[4] | ||
| 3326 | local _val_0 | ||
| 3327 | do | ||
| 3328 | local _obj_0 = _exp_0[1] | ||
| 3329 | if _obj_0 ~= nil then | ||
| 3330 | _val_0 = _obj_0.a | ||
| 3331 | end | ||
| 3332 | end | ||
| 3333 | local _val_1 | ||
| 3334 | do | ||
| 3335 | local _obj_0 = _exp_0[1] | ||
| 3336 | if _obj_0 ~= nil then | ||
| 3337 | _val_1 = _obj_0.b | ||
| 3338 | end | ||
| 3339 | end | ||
| 3340 | local _val_2 | ||
| 3341 | do | ||
| 3342 | local _obj_0 = _exp_0[2] | ||
| 3343 | if _obj_0 ~= nil then | ||
| 3344 | _val_2 = _obj_0.a | ||
| 3345 | end | ||
| 3346 | end | ||
| 3347 | local _val_3 | ||
| 3348 | do | ||
| 3349 | local _obj_0 = _exp_0[2] | ||
| 3350 | if _obj_0 ~= nil then | ||
| 3351 | _val_3 = _obj_0.b | ||
| 3352 | end | ||
| 3353 | end | ||
| 3354 | local _val_4 | ||
| 3355 | do | ||
| 3356 | local _obj_0 = _exp_0[3] | ||
| 3357 | if _obj_0 ~= nil then | ||
| 3358 | _val_4 = _obj_0.a | ||
| 3359 | end | ||
| 3360 | end | ||
| 3361 | local _val_5 | ||
| 3362 | do | ||
| 3363 | local _obj_0 = _exp_0[3] | ||
| 3364 | if _obj_0 ~= nil then | ||
| 3365 | _val_5 = _obj_0.b | ||
| 3366 | end | ||
| 3367 | end | ||
| 3368 | if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then | ||
| 3369 | print("匹配成功", fourth) | ||
| 3370 | end | ||
| 3371 | end | ||
| 3372 | local segments = { | ||
| 3373 | "admin", | ||
| 3374 | "users", | ||
| 3375 | "logs", | ||
| 3376 | "view" | ||
| 3377 | } | ||
| 3378 | local _type_0 = type(segments) | ||
| 3379 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3380 | if _tab_0 then | ||
| 3381 | local groups | ||
| 3382 | do | ||
| 3383 | local _accum_0 = { } | ||
| 3384 | local _len_0 = 1 | ||
| 3385 | local _max_0 = #segments + -3 + 1 | ||
| 3386 | for _index_0 = 1, _max_0 do | ||
| 3387 | local _item_0 = segments[_index_0] | ||
| 3388 | _accum_0[_len_0] = _item_0 | ||
| 3389 | _len_0 = _len_0 + 1 | ||
| 3390 | end | ||
| 3391 | groups = _accum_0 | ||
| 3392 | end | ||
| 3393 | local resource = segments[#segments - 1] | ||
| 3394 | local action = segments[#segments] | ||
| 3395 | if resource ~= nil and action ~= nil then | ||
| 3396 | print("Group:", groups) | ||
| 3397 | print("Resource:", resource) | ||
| 3398 | print("Action:", action) | ||
| 3399 | end | ||
| 3400 | end | ||
| 3401 | local name = "Dan" | ||
| 3402 | if "Robert" == name then | ||
| 3403 | print("你是Robert") | ||
| 3404 | elseif "Dan" == name or "Daniel" == name then | ||
| 3405 | print("你的名字是Dan") | ||
| 3406 | else | ||
| 3407 | print("我不认识你,你的名字是" .. tostring(name)) | ||
| 3408 | end | ||
| 3409 | local b = 1 | ||
| 3410 | local next_number | ||
| 3411 | if 1 == b then | ||
| 3412 | next_number = 2 | ||
| 3413 | elseif 2 == b then | ||
| 3414 | next_number = 3 | ||
| 3415 | else | ||
| 3416 | next_number = error("数字数得太大了!") | ||
| 3417 | end | ||
| 3418 | local msg | ||
| 3419 | local _exp_0 = math.random(1, 5) | ||
| 3420 | if 1 == _exp_0 then | ||
| 3421 | msg = "你很幸运" | ||
| 3422 | elseif 2 == _exp_0 then | ||
| 3423 | msg = "你差点很幸运" | ||
| 3424 | else | ||
| 3425 | msg = "不太幸运" | ||
| 3426 | end | ||
| 3427 | do | ||
| 3428 | local _exp_0 = math.random(1, 5) | ||
| 3429 | if 1 == _exp_0 then | ||
| 3430 | print("你很幸运") | ||
| 3431 | else | ||
| 3432 | print("不太幸运") | ||
| 3433 | end | ||
| 3434 | end | ||
| 3435 | local _exp_0 = math.random(1, 5) | ||
| 3436 | if 1 == _exp_0 then | ||
| 3437 | print("你很幸运") | ||
| 3438 | else | ||
| 3439 | print("不太幸运") | ||
| 3440 | end | ||
| 3441 | local items = { | ||
| 3442 | { | ||
| 3443 | x = 100, | ||
| 3444 | y = 200 | ||
| 3445 | }, | ||
| 3446 | { | ||
| 3447 | width = 300, | ||
| 3448 | height = 400 | ||
| 3449 | } | ||
| 3450 | } | ||
| 3451 | for _index_0 = 1, #items do | ||
| 3452 | local item = items[_index_0] | ||
| 3453 | local _type_0 = type(item) | ||
| 3454 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3455 | local _match_0 = false | ||
| 3456 | if _tab_0 then | ||
| 3457 | local x = item.x | ||
| 3458 | local y = item.y | ||
| 3459 | if x ~= nil and y ~= nil then | ||
| 3460 | _match_0 = true | ||
| 3461 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3462 | end | ||
| 3463 | end | ||
| 3464 | if not _match_0 then | ||
| 3465 | if _tab_0 then | ||
| 3466 | local width = item.width | ||
| 3467 | local height = item.height | ||
| 3468 | if width ~= nil and height ~= nil then | ||
| 3469 | print("尺寸 " .. tostring(width) .. ", " .. tostring(height)) | ||
| 3470 | end | ||
| 3471 | end | ||
| 3472 | end | ||
| 3473 | end | ||
| 3474 | local item = { } | ||
| 3475 | local x, y = item.pos.x, item.pos.y | ||
| 3476 | if x == nil then | ||
| 3477 | x = 50 | ||
| 3478 | end | ||
| 3479 | if y == nil then | ||
| 3480 | y = 200 | ||
| 3481 | end | ||
| 3482 | local _type_0 = type(item) | ||
| 3483 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3484 | if _tab_0 then | ||
| 3485 | do | ||
| 3486 | local _obj_0 = item.pos | ||
| 3487 | local _type_1 = type(_obj_0) | ||
| 3488 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3489 | x = _obj_0.x | ||
| 3490 | end | ||
| 3491 | end | ||
| 3492 | do | ||
| 3493 | local _obj_0 = item.pos | ||
| 3494 | local _type_1 = type(_obj_0) | ||
| 3495 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3496 | y = _obj_0.y | ||
| 3497 | end | ||
| 3498 | end | ||
| 3499 | if x == nil then | ||
| 3500 | x = 50 | ||
| 3501 | end | ||
| 3502 | if y == nil then | ||
| 3503 | y = 200 | ||
| 3504 | end | ||
| 3505 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3506 | end | ||
| 3507 | local _exp_0 = tb | ||
| 3508 | local _type_0 = type(_exp_0) | ||
| 3509 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3510 | local _match_0 = false | ||
| 3511 | if _tab_0 then | ||
| 3512 | if 1 == _exp_0[1] and 2 == _exp_0[2] and 3 == _exp_0[3] then | ||
| 3513 | _match_0 = true | ||
| 3514 | print("1, 2, 3") | ||
| 3515 | end | ||
| 3516 | end | ||
| 3517 | if not _match_0 then | ||
| 3518 | local _match_1 = false | ||
| 3519 | if _tab_0 then | ||
| 3520 | local b = _exp_0[2] | ||
| 3521 | if 1 == _exp_0[1] and b ~= nil and 3 == _exp_0[3] then | ||
| 3522 | _match_1 = true | ||
| 3523 | print("1, " .. tostring(b) .. ", 3") | ||
| 3524 | end | ||
| 3525 | end | ||
| 3526 | if not _match_1 then | ||
| 3527 | if _tab_0 then | ||
| 3528 | local b = _exp_0[3] | ||
| 3529 | if b == nil then | ||
| 3530 | b = 3 | ||
| 3531 | end | ||
| 3532 | if 1 == _exp_0[1] and 2 == _exp_0[2] then | ||
| 3533 | print("1, 2, " .. tostring(b)) | ||
| 3534 | end | ||
| 3535 | end | ||
| 3536 | end | ||
| 3537 | end | ||
| 3538 | local _exp_0 = tb | ||
| 3539 | local _type_0 = type(_exp_0) | ||
| 3540 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3541 | local _match_0 = false | ||
| 3542 | if _tab_0 then | ||
| 3543 | local result = _exp_0.result | ||
| 3544 | if true == _exp_0.success and result ~= nil then | ||
| 3545 | _match_0 = true | ||
| 3546 | print("成功", result) | ||
| 3547 | end | ||
| 3548 | end | ||
| 3549 | if not _match_0 then | ||
| 3550 | local _match_1 = false | ||
| 3551 | if _tab_0 then | ||
| 3552 | if false == _exp_0.success then | ||
| 3553 | _match_1 = true | ||
| 3554 | print("失败", result) | ||
| 3555 | end | ||
| 3556 | end | ||
| 3557 | if not _match_1 then | ||
| 3558 | print("无效值") | ||
| 3559 | end | ||
| 3560 | end | ||
| 3561 | local _exp_0 = tb | ||
| 3562 | local _type_0 = type(_exp_0) | ||
| 3563 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3564 | local _match_0 = false | ||
| 3565 | if _tab_0 then | ||
| 3566 | local content | ||
| 3567 | do | ||
| 3568 | local _obj_0 = _exp_0.data | ||
| 3569 | local _type_1 = type(_obj_0) | ||
| 3570 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3571 | content = _obj_0.content | ||
| 3572 | end | ||
| 3573 | end | ||
| 3574 | local _val_0 | ||
| 3575 | do | ||
| 3576 | local _obj_0 = _exp_0.data | ||
| 3577 | if _obj_0 ~= nil then | ||
| 3578 | _val_0 = _obj_0.type | ||
| 3579 | end | ||
| 3580 | end | ||
| 3581 | if "success" == _val_0 and content ~= nil then | ||
| 3582 | _match_0 = true | ||
| 3583 | print("成功", content) | ||
| 3584 | end | ||
| 3585 | end | ||
| 3586 | if not _match_0 then | ||
| 3587 | local _match_1 = false | ||
| 3588 | if _tab_0 then | ||
| 3589 | local content | ||
| 3590 | do | ||
| 3591 | local _obj_0 = _exp_0.data | ||
| 3592 | local _type_1 = type(_obj_0) | ||
| 3593 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3594 | content = _obj_0.content | ||
| 3595 | end | ||
| 3596 | end | ||
| 3597 | local _val_0 | ||
| 3598 | do | ||
| 3599 | local _obj_0 = _exp_0.data | ||
| 3600 | if _obj_0 ~= nil then | ||
| 3601 | _val_0 = _obj_0.type | ||
| 3602 | end | ||
| 3603 | end | ||
| 3604 | if "error" == _val_0 and content ~= nil then | ||
| 3605 | _match_1 = true | ||
| 3606 | print("失败", content) | ||
| 3607 | end | ||
| 3608 | end | ||
| 3609 | if not _match_1 then | ||
| 3610 | print("无效值") | ||
| 3611 | end | ||
| 3612 | end | ||
| 3613 | local _exp_0 = tb | ||
| 3614 | local _type_0 = type(_exp_0) | ||
| 3615 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3616 | if _tab_0 then | ||
| 3617 | local fourth = _exp_0[4] | ||
| 3618 | local _val_0 | ||
| 3619 | do | ||
| 3620 | local _obj_0 = _exp_0[1] | ||
| 3621 | if _obj_0 ~= nil then | ||
| 3622 | _val_0 = _obj_0.a | ||
| 3623 | end | ||
| 3624 | end | ||
| 3625 | local _val_1 | ||
| 3626 | do | ||
| 3627 | local _obj_0 = _exp_0[1] | ||
| 3628 | if _obj_0 ~= nil then | ||
| 3629 | _val_1 = _obj_0.b | ||
| 3630 | end | ||
| 3631 | end | ||
| 3632 | local _val_2 | ||
| 3633 | do | ||
| 3634 | local _obj_0 = _exp_0[2] | ||
| 3635 | if _obj_0 ~= nil then | ||
| 3636 | _val_2 = _obj_0.a | ||
| 3637 | end | ||
| 3638 | end | ||
| 3639 | local _val_3 | ||
| 3640 | do | ||
| 3641 | local _obj_0 = _exp_0[2] | ||
| 3642 | if _obj_0 ~= nil then | ||
| 3643 | _val_3 = _obj_0.b | ||
| 3644 | end | ||
| 3645 | end | ||
| 3646 | local _val_4 | ||
| 3647 | do | ||
| 3648 | local _obj_0 = _exp_0[3] | ||
| 3649 | if _obj_0 ~= nil then | ||
| 3650 | _val_4 = _obj_0.a | ||
| 3651 | end | ||
| 3652 | end | ||
| 3653 | local _val_5 | ||
| 3654 | do | ||
| 3655 | local _obj_0 = _exp_0[3] | ||
| 3656 | if _obj_0 ~= nil then | ||
| 3657 | _val_5 = _obj_0.b | ||
| 3658 | end | ||
| 3659 | end | ||
| 3660 | if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then | ||
| 3661 | print("匹配成功", fourth) | ||
| 3662 | end | ||
| 3663 | end | ||
| 3664 | local segments = { | ||
| 3665 | "admin", | ||
| 3666 | "users", | ||
| 3667 | "logs", | ||
| 3668 | "view" | ||
| 3669 | } | ||
| 3670 | local _type_0 = type(segments) | ||
| 3671 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3672 | if _tab_0 then | ||
| 3673 | local groups | ||
| 3674 | do | ||
| 3675 | local _accum_0 = { } | ||
| 3676 | local _len_0 = 1 | ||
| 3677 | local _max_0 = #segments + -3 + 1 | ||
| 3678 | for _index_0 = 1, _max_0 do | ||
| 3679 | local _item_0 = segments[_index_0] | ||
| 3680 | _accum_0[_len_0] = _item_0 | ||
| 3681 | _len_0 = _len_0 + 1 | ||
| 3682 | end | ||
| 3683 | groups = _accum_0 | ||
| 3684 | end | ||
| 3685 | local resource = segments[#segments - 1] | ||
| 3686 | local action = segments[#segments] | ||
| 3687 | if resource ~= nil and action ~= nil then | ||
| 3688 | print("Group:", groups) | ||
| 3689 | print("Resource:", resource) | ||
| 3690 | print("Action:", action) | ||
| 3691 | end | ||
| 3692 | end | ||
| 3693 | local Inventory | 1149 | local Inventory |
| 3694 | local _class_0 | 1150 | local _class_0 |
| 3695 | local _base_0 = { | 1151 | local _base_0 = { |
| @@ -5010,86 +2466,440 @@ local _with_0 = obj | |||
| 5010 | if _with_0 ~= nil then | 2466 | if _with_0 ~= nil then |
| 5011 | print(obj.name) | 2467 | print(obj.name) |
| 5012 | end | 2468 | end |
| 2469 | local hello = "world" | ||
| 2470 | local a, b, c = 1, 2, 3 | ||
| 2471 | hello = 123 | ||
| 2472 | local x = 1 | ||
| 2473 | x = x + 1 | ||
| 2474 | x = x - 1 | ||
| 2475 | x = x * 10 | ||
| 2476 | x = x / 10 | ||
| 2477 | x = x % 10 | ||
| 2478 | local s = s .. "world" | ||
| 2479 | local arg = arg or "默认值" | ||
| 2480 | local a = 0 | ||
| 2481 | local b = 0 | ||
| 2482 | local c = 0 | ||
| 2483 | local d = 0 | ||
| 2484 | local e = 0 | ||
| 2485 | local x = f() | ||
| 2486 | local y = x | ||
| 2487 | local z = x | ||
| 2488 | do | ||
| 2489 | local a = 1 | ||
| 2490 | local x, y, z | ||
| 2491 | print("预先声明后续所有变量为局部变量") | ||
| 2492 | x = function() | ||
| 2493 | return 1 + y + z | ||
| 2494 | end | ||
| 2495 | y, z = 2, 3 | ||
| 2496 | instance = Item:new() | ||
| 2497 | end | ||
| 5013 | do | 2498 | do |
| 5014 | local var = "hello" | 2499 | local X = 1 |
| 5015 | print(var) | 2500 | local B |
| 2501 | print("只预先声明后续大写的变量为局部变量") | ||
| 2502 | local a = 1 | ||
| 2503 | B = 2 | ||
| 5016 | end | 2504 | end |
| 5017 | print(var) | ||
| 5018 | local counter | ||
| 5019 | do | 2505 | do |
| 5020 | local i = 0 | 2506 | a = 1 |
| 5021 | counter = function() | 2507 | print("预先声明所有变量为全局变量") |
| 5022 | i = i + 1 | 2508 | x = function() |
| 5023 | return i | 2509 | return 1 + y + z |
| 5024 | end | 2510 | end |
| 2511 | y, z = 2, 3 | ||
| 5025 | end | 2512 | end |
| 5026 | print(counter()) | ||
| 5027 | print(counter()) | ||
| 5028 | local tbl = { | ||
| 5029 | key = (function() | ||
| 5030 | print("分配键值!") | ||
| 5031 | return 1234 | ||
| 5032 | end)() | ||
| 5033 | } | ||
| 5034 | do | 2513 | do |
| 5035 | local var = "hello" | 2514 | x = 1 |
| 5036 | print(var) | 2515 | print("只预先声明大写的变量为全局变量") |
| 2516 | local a = 1 | ||
| 2517 | B = 2 | ||
| 2518 | local Temp = "一个局部值" | ||
| 5037 | end | 2519 | end |
| 5038 | print(var) | 2520 | local hello = "world" |
| 5039 | local counter | 2521 | local a, b, c = 1, 2, 3 |
| 2522 | hello = 123 | ||
| 2523 | local x = 1 | ||
| 2524 | x = x + 1 | ||
| 2525 | x = x - 1 | ||
| 2526 | x = x * 10 | ||
| 2527 | x = x / 10 | ||
| 2528 | x = x % 10 | ||
| 2529 | local s = s .. "world" | ||
| 2530 | local arg = arg or "默认值" | ||
| 2531 | local a = 0 | ||
| 2532 | local b = 0 | ||
| 2533 | local c = 0 | ||
| 2534 | local d = 0 | ||
| 2535 | local e = 0 | ||
| 2536 | local x = f() | ||
| 2537 | local y = x | ||
| 2538 | local z = x | ||
| 5040 | do | 2539 | do |
| 5041 | local i = 0 | 2540 | local a = 1 |
| 5042 | counter = function() | 2541 | local x, y, z |
| 5043 | i = i + 1 | 2542 | print("预先声明后续所有变量为局部变量") |
| 5044 | return i | 2543 | x = function() |
| 2544 | return 1 + y + z | ||
| 5045 | end | 2545 | end |
| 2546 | y, z = 2, 3 | ||
| 2547 | instance = Item:new() | ||
| 5046 | end | 2548 | end |
| 5047 | print(counter()) | 2549 | do |
| 5048 | print(counter()) | 2550 | local X = 1 |
| 5049 | local tbl = { | 2551 | local B |
| 5050 | key = (function() | 2552 | print("只预先声明后续大写的变量为局部变量") |
| 5051 | print("分配键值!") | 2553 | local a = 1 |
| 5052 | return 1234 | 2554 | B = 2 |
| 5053 | end)() | 2555 | end |
| 5054 | } | 2556 | do |
| 5055 | local my_object = { | 2557 | a = 1 |
| 5056 | value = 1000, | 2558 | print("预先声明所有变量为全局变量") |
| 5057 | write = function(self) | 2559 | x = function() |
| 5058 | return print("值为:", self.value) | 2560 | return 1 + y + z |
| 5059 | end | 2561 | end |
| 2562 | y, z = 2, 3 | ||
| 2563 | end | ||
| 2564 | do | ||
| 2565 | x = 1 | ||
| 2566 | print("只预先声明大写的变量为全局变量") | ||
| 2567 | local a = 1 | ||
| 2568 | B = 2 | ||
| 2569 | local Temp = "一个局部值" | ||
| 2570 | end | ||
| 2571 | local list = { | ||
| 2572 | 1, | ||
| 2573 | 2, | ||
| 2574 | 3, | ||
| 2575 | 4, | ||
| 2576 | 5 | ||
| 5060 | } | 2577 | } |
| 5061 | local run_callback | 2578 | local fn |
| 5062 | run_callback = function(func) | 2579 | fn = function(ok) |
| 5063 | print("运行回调...") | 2580 | return ok, table.unpack(list) |
| 5064 | return func() | ||
| 5065 | end | 2581 | end |
| 5066 | run_callback(my_object.write) | 2582 | (function(_arg_0, ...) |
| 5067 | run_callback((function() | 2583 | local ok = _arg_0 |
| 5068 | local _base_0 = my_object | 2584 | local count = select('#', ...) |
| 5069 | local _fn_0 = _base_0.write | 2585 | local first = select(1, ...) |
| 5070 | return _fn_0 and function(...) | 2586 | return print(ok, count, first) |
| 5071 | return _fn_0(_base_0, ...) | 2587 | end)(fn(true)) |
| 2588 | local list = { | ||
| 2589 | 1, | ||
| 2590 | 2, | ||
| 2591 | 3, | ||
| 2592 | 4, | ||
| 2593 | 5 | ||
| 2594 | } | ||
| 2595 | local fn | ||
| 2596 | fn = function(ok) | ||
| 2597 | return ok, table.unpack(list) | ||
| 2598 | end | ||
| 2599 | (function(_arg_0, ...) | ||
| 2600 | local ok = _arg_0 | ||
| 2601 | local count = select('#', ...) | ||
| 2602 | local first = select(1, ...) | ||
| 2603 | return print(ok, count, first) | ||
| 2604 | end)(fn(true)) | ||
| 2605 | local user = database.find_user("moon") | ||
| 2606 | if user then | ||
| 2607 | print(user.name) | ||
| 2608 | end | ||
| 2609 | local hello = os.getenv("hello") | ||
| 2610 | if hello then | ||
| 2611 | print("你有 hello", hello) | ||
| 2612 | else | ||
| 2613 | local world = os.getenv("world") | ||
| 2614 | if world then | ||
| 2615 | print("你有 world", world) | ||
| 2616 | else | ||
| 2617 | print("什么都没有 :(") | ||
| 5072 | end | 2618 | end |
| 5073 | end)()) | 2619 | end |
| 5074 | local my_object = { | 2620 | do |
| 5075 | value = 1000, | 2621 | local success, result = pcall(function() |
| 5076 | write = function(self) | 2622 | return "无报错地获取结果" |
| 5077 | return print("值为:", self.value) | 2623 | end) |
| 2624 | if success then | ||
| 2625 | print(result) | ||
| 5078 | end | 2626 | end |
| 2627 | end | ||
| 2628 | print("好的") | ||
| 2629 | repeat | ||
| 2630 | local byte = stream:read_one() | ||
| 2631 | if byte then | ||
| 2632 | print(byte) | ||
| 2633 | else | ||
| 2634 | break | ||
| 2635 | end | ||
| 2636 | until false | ||
| 2637 | local user = database.find_user("moon") | ||
| 2638 | if user then | ||
| 2639 | print(user.name) | ||
| 2640 | end | ||
| 2641 | local hello = os.getenv("hello") | ||
| 2642 | if hello then | ||
| 2643 | print("你有 hello", hello) | ||
| 2644 | else | ||
| 2645 | local world = os.getenv("world") | ||
| 2646 | if world then | ||
| 2647 | print("你有 world", world) | ||
| 2648 | else | ||
| 2649 | print("什么都没有 :(") | ||
| 2650 | end | ||
| 2651 | end | ||
| 2652 | do | ||
| 2653 | local success, result = pcall(function() | ||
| 2654 | return "无报错地获取结果" | ||
| 2655 | end) | ||
| 2656 | if success then | ||
| 2657 | print(result) | ||
| 2658 | end | ||
| 2659 | end | ||
| 2660 | print("好的") | ||
| 2661 | repeat | ||
| 2662 | local byte = stream:read_one() | ||
| 2663 | if byte then | ||
| 2664 | print(byte) | ||
| 2665 | else | ||
| 2666 | break | ||
| 2667 | end | ||
| 2668 | until false | ||
| 2669 | local thing = { | ||
| 2670 | 1, | ||
| 2671 | 2 | ||
| 5079 | } | 2672 | } |
| 5080 | local run_callback | 2673 | local a, b = thing[1], thing[2] |
| 5081 | run_callback = function(func) | 2674 | print(a, b) |
| 5082 | print("运行回调...") | 2675 | local obj = { |
| 5083 | return func() | 2676 | hello = "world", |
| 2677 | day = "tuesday", | ||
| 2678 | length = 20 | ||
| 2679 | } | ||
| 2680 | local hello, the_day = obj.hello, obj.day | ||
| 2681 | print(hello, the_day) | ||
| 2682 | local day = obj.day | ||
| 2683 | local obj2 = { | ||
| 2684 | numbers = { | ||
| 2685 | 1, | ||
| 2686 | 2, | ||
| 2687 | 3, | ||
| 2688 | 4 | ||
| 2689 | }, | ||
| 2690 | properties = { | ||
| 2691 | color = "green", | ||
| 2692 | height = 13.5 | ||
| 2693 | } | ||
| 2694 | } | ||
| 2695 | local first, second, color = obj2.numbers[1], obj2.numbers[2], obj2.properties.color | ||
| 2696 | print(first, second, color) | ||
| 2697 | local first, second, color | ||
| 2698 | local _obj_0 = obj2 | ||
| 2699 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color | ||
| 2700 | local concat, insert | ||
| 2701 | local _obj_0 = table | ||
| 2702 | concat, insert = _obj_0.concat, _obj_0.insert | ||
| 2703 | local mix, max, rand | ||
| 2704 | local _obj_0 = math | ||
| 2705 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random | ||
| 2706 | local name, job | ||
| 2707 | local _obj_0 = person | ||
| 2708 | name, job = _obj_0.name, _obj_0.job | ||
| 2709 | if name == nil then | ||
| 2710 | name = "nameless" | ||
| 5084 | end | 2711 | end |
| 5085 | run_callback(my_object.write) | 2712 | if job == nil then |
| 5086 | run_callback((function() | 2713 | job = "jobless" |
| 5087 | local _base_0 = my_object | 2714 | end |
| 5088 | local _fn_0 = _base_0.write | 2715 | local two, four |
| 5089 | return _fn_0 and function(...) | 2716 | local _obj_0 = items |
| 5090 | return _fn_0(_base_0, ...) | 2717 | two, four = _obj_0[2], _obj_0[4] |
| 2718 | local orders = { | ||
| 2719 | "first", | ||
| 2720 | "second", | ||
| 2721 | "third", | ||
| 2722 | "fourth", | ||
| 2723 | "last" | ||
| 2724 | } | ||
| 2725 | local first, bulk, last = orders[1], (function() | ||
| 2726 | local _accum_0 = { } | ||
| 2727 | local _len_0 = 1 | ||
| 2728 | local _max_0 = #orders + -2 + 1 | ||
| 2729 | for _index_0 = 2, _max_0 do | ||
| 2730 | local _item_0 = orders[_index_0] | ||
| 2731 | _accum_0[_len_0] = _item_0 | ||
| 2732 | _len_0 = _len_0 + 1 | ||
| 5091 | end | 2733 | end |
| 5092 | end)()) | 2734 | return _accum_0 |
| 2735 | end)(), orders[#orders] | ||
| 2736 | print(first) | ||
| 2737 | print(bulk) | ||
| 2738 | print(last) | ||
| 2739 | local first, rest | ||
| 2740 | do | ||
| 2741 | local _obj_0 = orders | ||
| 2742 | first, rest = _obj_0[1], (function() | ||
| 2743 | local _accum_0 = { } | ||
| 2744 | local _len_0 = 1 | ||
| 2745 | local _max_0 = #_obj_0 | ||
| 2746 | for _index_0 = 2, _max_0 do | ||
| 2747 | local _item_0 = _obj_0[_index_0] | ||
| 2748 | _accum_0[_len_0] = _item_0 | ||
| 2749 | _len_0 = _len_0 + 1 | ||
| 2750 | end | ||
| 2751 | return _accum_0 | ||
| 2752 | end)() | ||
| 2753 | end | ||
| 2754 | local start, last | ||
| 2755 | do | ||
| 2756 | local _obj_0 = orders | ||
| 2757 | start, last = (function() | ||
| 2758 | local _accum_0 = { } | ||
| 2759 | local _len_0 = 1 | ||
| 2760 | local _max_0 = #_obj_0 + -2 + 1 | ||
| 2761 | for _index_0 = 1, _max_0 do | ||
| 2762 | local _item_0 = _obj_0[_index_0] | ||
| 2763 | _accum_0[_len_0] = _item_0 | ||
| 2764 | _len_0 = _len_0 + 1 | ||
| 2765 | end | ||
| 2766 | return _accum_0 | ||
| 2767 | end)(), _obj_0[#_obj_0] | ||
| 2768 | end | ||
| 2769 | local _obj_0 = orders | ||
| 2770 | first, last = _obj_0[1], _obj_0[#_obj_0] | ||
| 2771 | local tuples = { | ||
| 2772 | { | ||
| 2773 | "hello", | ||
| 2774 | "world" | ||
| 2775 | }, | ||
| 2776 | { | ||
| 2777 | "egg", | ||
| 2778 | "head" | ||
| 2779 | } | ||
| 2780 | } | ||
| 2781 | for _index_0 = 1, #tuples do | ||
| 2782 | local _des_0 = tuples[_index_0] | ||
| 2783 | local left, right = _des_0[1], _des_0[2] | ||
| 2784 | print(left, right) | ||
| 2785 | end | ||
| 2786 | local thing = { | ||
| 2787 | 1, | ||
| 2788 | 2 | ||
| 2789 | } | ||
| 2790 | local a, b = thing[1], thing[2] | ||
| 2791 | print(a, b) | ||
| 2792 | local obj = { | ||
| 2793 | hello = "world", | ||
| 2794 | day = "tuesday", | ||
| 2795 | length = 20 | ||
| 2796 | } | ||
| 2797 | local hello, the_day = obj.hello, obj.day | ||
| 2798 | print(hello, the_day) | ||
| 2799 | local day = obj.day | ||
| 2800 | local obj2 = { | ||
| 2801 | numbers = { | ||
| 2802 | 1, | ||
| 2803 | 2, | ||
| 2804 | 3, | ||
| 2805 | 4 | ||
| 2806 | }, | ||
| 2807 | properties = { | ||
| 2808 | color = "green", | ||
| 2809 | height = 13.5 | ||
| 2810 | } | ||
| 2811 | } | ||
| 2812 | local first, second, color = obj2.numbers[1], obj2.numbers[2], obj2.properties.color | ||
| 2813 | print(first, second, color) | ||
| 2814 | local first, second, color | ||
| 2815 | local _obj_0 = obj2 | ||
| 2816 | first, second, color = _obj_0.numbers[1], _obj_0.numbers[2], _obj_0.properties.color | ||
| 2817 | local concat, insert | ||
| 2818 | local _obj_0 = table | ||
| 2819 | concat, insert = _obj_0.concat, _obj_0.insert | ||
| 2820 | local mix, max, rand | ||
| 2821 | local _obj_0 = math | ||
| 2822 | mix, max, rand = _obj_0.mix, _obj_0.max, _obj_0.random | ||
| 2823 | local name, job | ||
| 2824 | local _obj_0 = person | ||
| 2825 | name, job = _obj_0.name, _obj_0.job | ||
| 2826 | if name == nil then | ||
| 2827 | name = "nameless" | ||
| 2828 | end | ||
| 2829 | if job == nil then | ||
| 2830 | job = "jobless" | ||
| 2831 | end | ||
| 2832 | local two, four | ||
| 2833 | local _obj_0 = items | ||
| 2834 | two, four = _obj_0[2], _obj_0[4] | ||
| 2835 | local orders = { | ||
| 2836 | "first", | ||
| 2837 | "second", | ||
| 2838 | "third", | ||
| 2839 | "fourth", | ||
| 2840 | "last" | ||
| 2841 | } | ||
| 2842 | local first, bulk, last = orders[1], (function() | ||
| 2843 | local _accum_0 = { } | ||
| 2844 | local _len_0 = 1 | ||
| 2845 | local _max_0 = #orders + -2 + 1 | ||
| 2846 | for _index_0 = 2, _max_0 do | ||
| 2847 | local _item_0 = orders[_index_0] | ||
| 2848 | _accum_0[_len_0] = _item_0 | ||
| 2849 | _len_0 = _len_0 + 1 | ||
| 2850 | end | ||
| 2851 | return _accum_0 | ||
| 2852 | end)(), orders[#orders] | ||
| 2853 | print(first) | ||
| 2854 | print(bulk) | ||
| 2855 | print(last) | ||
| 2856 | local first, rest | ||
| 2857 | do | ||
| 2858 | local _obj_0 = orders | ||
| 2859 | first, rest = _obj_0[1], (function() | ||
| 2860 | local _accum_0 = { } | ||
| 2861 | local _len_0 = 1 | ||
| 2862 | local _max_0 = #_obj_0 | ||
| 2863 | for _index_0 = 2, _max_0 do | ||
| 2864 | local _item_0 = _obj_0[_index_0] | ||
| 2865 | _accum_0[_len_0] = _item_0 | ||
| 2866 | _len_0 = _len_0 + 1 | ||
| 2867 | end | ||
| 2868 | return _accum_0 | ||
| 2869 | end)() | ||
| 2870 | end | ||
| 2871 | local start, last | ||
| 2872 | do | ||
| 2873 | local _obj_0 = orders | ||
| 2874 | start, last = (function() | ||
| 2875 | local _accum_0 = { } | ||
| 2876 | local _len_0 = 1 | ||
| 2877 | local _max_0 = #_obj_0 + -2 + 1 | ||
| 2878 | for _index_0 = 1, _max_0 do | ||
| 2879 | local _item_0 = _obj_0[_index_0] | ||
| 2880 | _accum_0[_len_0] = _item_0 | ||
| 2881 | _len_0 = _len_0 + 1 | ||
| 2882 | end | ||
| 2883 | return _accum_0 | ||
| 2884 | end)(), _obj_0[#_obj_0] | ||
| 2885 | end | ||
| 2886 | local _obj_0 = orders | ||
| 2887 | first, last = _obj_0[1], _obj_0[#_obj_0] | ||
| 2888 | local tuples = { | ||
| 2889 | { | ||
| 2890 | "hello", | ||
| 2891 | "world" | ||
| 2892 | }, | ||
| 2893 | { | ||
| 2894 | "egg", | ||
| 2895 | "head" | ||
| 2896 | } | ||
| 2897 | } | ||
| 2898 | for _index_0 = 1, #tuples do | ||
| 2899 | local _des_0 = tuples[_index_0] | ||
| 2900 | local left, right = _des_0[1], _des_0[2] | ||
| 2901 | print(left, right) | ||
| 2902 | end | ||
| 5093 | local i = 100 | 2903 | local i = 100 |
| 5094 | local my_func | 2904 | local my_func |
| 5095 | my_func = function() | 2905 | my_func = function() |
| @@ -5146,3 +2956,2193 @@ my_func = function(add) | |||
| 5146 | end | 2956 | end |
| 5147 | my_func(22) | 2957 | my_func(22) |
| 5148 | print(i, k) | 2958 | print(i, k) |
| 2959 | local _module_0 = { } | ||
| 2960 | local p, to_lua | ||
| 2961 | do | ||
| 2962 | local _obj_0 = require("yue") | ||
| 2963 | p, to_lua = _obj_0.p, _obj_0.to_lua | ||
| 2964 | end | ||
| 2965 | local inventory = { | ||
| 2966 | equipment = { | ||
| 2967 | "sword", | ||
| 2968 | "shield" | ||
| 2969 | }, | ||
| 2970 | items = { | ||
| 2971 | { | ||
| 2972 | name = "potion", | ||
| 2973 | count = 10 | ||
| 2974 | }, | ||
| 2975 | { | ||
| 2976 | name = "bread", | ||
| 2977 | count = 3 | ||
| 2978 | } | ||
| 2979 | } | ||
| 2980 | } | ||
| 2981 | local map | ||
| 2982 | map = function(arr, action) | ||
| 2983 | local _accum_0 = { } | ||
| 2984 | local _len_0 = 1 | ||
| 2985 | for _index_0 = 1, #arr do | ||
| 2986 | local item = arr[_index_0] | ||
| 2987 | _accum_0[_len_0] = action(item) | ||
| 2988 | _len_0 = _len_0 + 1 | ||
| 2989 | end | ||
| 2990 | return _accum_0 | ||
| 2991 | end | ||
| 2992 | local filter | ||
| 2993 | filter = function(arr, cond) | ||
| 2994 | local _accum_0 = { } | ||
| 2995 | local _len_0 = 1 | ||
| 2996 | for _index_0 = 1, #arr do | ||
| 2997 | local item = arr[_index_0] | ||
| 2998 | if cond(item) then | ||
| 2999 | _accum_0[_len_0] = item | ||
| 3000 | _len_0 = _len_0 + 1 | ||
| 3001 | end | ||
| 3002 | end | ||
| 3003 | return _accum_0 | ||
| 3004 | end | ||
| 3005 | local reduce | ||
| 3006 | reduce = function(arr, init, action) | ||
| 3007 | for _index_0 = 1, #arr do | ||
| 3008 | local item = arr[_index_0] | ||
| 3009 | init = action(init, item) | ||
| 3010 | end | ||
| 3011 | return init | ||
| 3012 | end | ||
| 3013 | print(reduce(filter(map({ | ||
| 3014 | 1, | ||
| 3015 | 2, | ||
| 3016 | 3 | ||
| 3017 | }, function(x) | ||
| 3018 | return x * 2 | ||
| 3019 | end), function(x) | ||
| 3020 | return x > 4 | ||
| 3021 | end), 0, function(a, b) | ||
| 3022 | return a + b | ||
| 3023 | end)) | ||
| 3024 | local apple = setmetatable({ | ||
| 3025 | size = 15, | ||
| 3026 | }, { | ||
| 3027 | __index = { | ||
| 3028 | color = 0x00ffff | ||
| 3029 | } | ||
| 3030 | }) | ||
| 3031 | if (getmetatable(apple) ~= nil) then | ||
| 3032 | p(apple.size, apple.color, getmetatable(apple).__index) | ||
| 3033 | end | ||
| 3034 | local _u1f31b = "月之脚本" | ||
| 3035 | _module_0["🌛"] = _u1f31b | ||
| 3036 | return _module_0 | ||
| 3037 | local _module_0 = { } | ||
| 3038 | local p, to_lua | ||
| 3039 | do | ||
| 3040 | local _obj_0 = require("yue") | ||
| 3041 | p, to_lua = _obj_0.p, _obj_0.to_lua | ||
| 3042 | end | ||
| 3043 | local inventory = { | ||
| 3044 | equipment = { | ||
| 3045 | "sword", | ||
| 3046 | "shield" | ||
| 3047 | }, | ||
| 3048 | items = { | ||
| 3049 | { | ||
| 3050 | name = "potion", | ||
| 3051 | count = 10 | ||
| 3052 | }, | ||
| 3053 | { | ||
| 3054 | name = "bread", | ||
| 3055 | count = 3 | ||
| 3056 | } | ||
| 3057 | } | ||
| 3058 | } | ||
| 3059 | local map | ||
| 3060 | map = function(arr, action) | ||
| 3061 | local _accum_0 = { } | ||
| 3062 | local _len_0 = 1 | ||
| 3063 | for _index_0 = 1, #arr do | ||
| 3064 | local item = arr[_index_0] | ||
| 3065 | _accum_0[_len_0] = action(item) | ||
| 3066 | _len_0 = _len_0 + 1 | ||
| 3067 | end | ||
| 3068 | return _accum_0 | ||
| 3069 | end | ||
| 3070 | local filter | ||
| 3071 | filter = function(arr, cond) | ||
| 3072 | local _accum_0 = { } | ||
| 3073 | local _len_0 = 1 | ||
| 3074 | for _index_0 = 1, #arr do | ||
| 3075 | local item = arr[_index_0] | ||
| 3076 | if cond(item) then | ||
| 3077 | _accum_0[_len_0] = item | ||
| 3078 | _len_0 = _len_0 + 1 | ||
| 3079 | end | ||
| 3080 | end | ||
| 3081 | return _accum_0 | ||
| 3082 | end | ||
| 3083 | local reduce | ||
| 3084 | reduce = function(arr, init, action) | ||
| 3085 | for _index_0 = 1, #arr do | ||
| 3086 | local item = arr[_index_0] | ||
| 3087 | init = action(init, item) | ||
| 3088 | end | ||
| 3089 | return init | ||
| 3090 | end | ||
| 3091 | print(reduce(filter(map({ | ||
| 3092 | 1, | ||
| 3093 | 2, | ||
| 3094 | 3 | ||
| 3095 | }, function(x) | ||
| 3096 | return x * 2 | ||
| 3097 | end), function(x) | ||
| 3098 | return x > 4 | ||
| 3099 | end), 0, function(a, b) | ||
| 3100 | return a + b | ||
| 3101 | end)) | ||
| 3102 | local apple = setmetatable({ | ||
| 3103 | size = 15, | ||
| 3104 | }, { | ||
| 3105 | __index = { | ||
| 3106 | color = 0x00ffff | ||
| 3107 | } | ||
| 3108 | }) | ||
| 3109 | if (getmetatable(apple) ~= nil) then | ||
| 3110 | p(apple.size, apple.color, getmetatable(apple).__index) | ||
| 3111 | end | ||
| 3112 | local _u1f31b = "月之脚本" | ||
| 3113 | _module_0["🌛"] = _u1f31b | ||
| 3114 | return _module_0 | ||
| 3115 | local have_coins = false | ||
| 3116 | if have_coins then | ||
| 3117 | print("有硬币") | ||
| 3118 | else | ||
| 3119 | print("没有硬币") | ||
| 3120 | end | ||
| 3121 | local have_coins = false | ||
| 3122 | if have_coins then | ||
| 3123 | print("有硬币") | ||
| 3124 | else | ||
| 3125 | print("没有硬币") | ||
| 3126 | end | ||
| 3127 | local have_coins = false | ||
| 3128 | print((function() | ||
| 3129 | if have_coins then | ||
| 3130 | return "有硬币" | ||
| 3131 | else | ||
| 3132 | return "没有硬币" | ||
| 3133 | end | ||
| 3134 | end)()) | ||
| 3135 | local is_tall | ||
| 3136 | is_tall = function(name) | ||
| 3137 | if name == "Rob" then | ||
| 3138 | return true | ||
| 3139 | else | ||
| 3140 | return false | ||
| 3141 | end | ||
| 3142 | end | ||
| 3143 | local message | ||
| 3144 | if is_tall("Rob") then | ||
| 3145 | message = "我很高" | ||
| 3146 | else | ||
| 3147 | message = "我不是很高" | ||
| 3148 | end | ||
| 3149 | print(message) | ||
| 3150 | if not (os.date("%A") == "Monday") then | ||
| 3151 | print("今天不是星期一!") | ||
| 3152 | end | ||
| 3153 | if not (math.random() > 0.1) then | ||
| 3154 | print("你真幸运!") | ||
| 3155 | end | ||
| 3156 | local a = 5 | ||
| 3157 | if (1 == a or 3 == a or 5 == a or 7 == a) then | ||
| 3158 | print("检查离散值的相等性") | ||
| 3159 | end | ||
| 3160 | if (function() | ||
| 3161 | local _check_0 = list | ||
| 3162 | for _index_0 = 1, #_check_0 do | ||
| 3163 | if _check_0[_index_0] == a then | ||
| 3164 | return true | ||
| 3165 | end | ||
| 3166 | end | ||
| 3167 | return false | ||
| 3168 | end)() then | ||
| 3169 | print("检查`a`是否在列表中") | ||
| 3170 | end | ||
| 3171 | if not (math.random() > 0.1) then | ||
| 3172 | print("你很幸运!") | ||
| 3173 | end | ||
| 3174 | local have_coins = false | ||
| 3175 | if have_coins then | ||
| 3176 | print("有硬币") | ||
| 3177 | else | ||
| 3178 | print("没有硬币") | ||
| 3179 | end | ||
| 3180 | local have_coins = false | ||
| 3181 | if have_coins then | ||
| 3182 | print("有硬币") | ||
| 3183 | else | ||
| 3184 | print("没有硬币") | ||
| 3185 | end | ||
| 3186 | local have_coins = false | ||
| 3187 | print((function() | ||
| 3188 | if have_coins then | ||
| 3189 | return "有硬币" | ||
| 3190 | else | ||
| 3191 | return "没有硬币" | ||
| 3192 | end | ||
| 3193 | end)()) | ||
| 3194 | local is_tall | ||
| 3195 | is_tall = function(name) | ||
| 3196 | if name == "Rob" then | ||
| 3197 | return true | ||
| 3198 | else | ||
| 3199 | return false | ||
| 3200 | end | ||
| 3201 | end | ||
| 3202 | local message | ||
| 3203 | if is_tall("Rob") then | ||
| 3204 | message = "我很高" | ||
| 3205 | else | ||
| 3206 | message = "我不是很高" | ||
| 3207 | end | ||
| 3208 | print(message) | ||
| 3209 | if not (os.date("%A") == "Monday") then | ||
| 3210 | print("今天不是星期一!") | ||
| 3211 | end | ||
| 3212 | if not (math.random() > 0.1) then | ||
| 3213 | print("你真幸运!") | ||
| 3214 | end | ||
| 3215 | local a = 5 | ||
| 3216 | if (1 == a or 3 == a or 5 == a or 7 == a) then | ||
| 3217 | print("检查离散值的相等性") | ||
| 3218 | end | ||
| 3219 | if (function() | ||
| 3220 | local _check_0 = list | ||
| 3221 | for _index_0 = 1, #_check_0 do | ||
| 3222 | if _check_0[_index_0] == a then | ||
| 3223 | return true | ||
| 3224 | end | ||
| 3225 | end | ||
| 3226 | return false | ||
| 3227 | end)() then | ||
| 3228 | print("检查`a`是否在列表中") | ||
| 3229 | end | ||
| 3230 | if not (math.random() > 0.1) then | ||
| 3231 | print("你很幸运!") | ||
| 3232 | end | ||
| 3233 | for i = 10, 20 do | ||
| 3234 | print(i) | ||
| 3235 | end | ||
| 3236 | for k = 1, 15, 2 do | ||
| 3237 | print(k) | ||
| 3238 | end | ||
| 3239 | for key, value in pairs(object) do | ||
| 3240 | print(key, value) | ||
| 3241 | end | ||
| 3242 | local _list_0 = items | ||
| 3243 | for _index_0 = 2, 4 do | ||
| 3244 | local item = _list_0[_index_0] | ||
| 3245 | print(item) | ||
| 3246 | end | ||
| 3247 | local _list_0 = items | ||
| 3248 | for _index_0 = 1, #_list_0 do | ||
| 3249 | local item = _list_0[_index_0] | ||
| 3250 | print(item) | ||
| 3251 | end | ||
| 3252 | for j = 1, 10, 3 do | ||
| 3253 | print(j) | ||
| 3254 | end | ||
| 3255 | local doubled_evens | ||
| 3256 | local _accum_0 = { } | ||
| 3257 | local _len_0 = 1 | ||
| 3258 | for i = 1, 20 do | ||
| 3259 | if i % 2 == 0 then | ||
| 3260 | _accum_0[_len_0] = i * 2 | ||
| 3261 | _len_0 = _len_0 + 1 | ||
| 3262 | else | ||
| 3263 | _accum_0[_len_0] = i | ||
| 3264 | _len_0 = _len_0 + 1 | ||
| 3265 | end | ||
| 3266 | end | ||
| 3267 | doubled_evens = _accum_0 | ||
| 3268 | local first_large | ||
| 3269 | local _accum_0 | ||
| 3270 | local _list_0 = numbers | ||
| 3271 | for _index_0 = 1, #_list_0 do | ||
| 3272 | local n = _list_0[_index_0] | ||
| 3273 | if n > 10 then | ||
| 3274 | _accum_0 = n | ||
| 3275 | break | ||
| 3276 | end | ||
| 3277 | end | ||
| 3278 | first_large = _accum_0 | ||
| 3279 | local func_a | ||
| 3280 | func_a = function() | ||
| 3281 | for i = 1, 10 do | ||
| 3282 | print(i) | ||
| 3283 | end | ||
| 3284 | end | ||
| 3285 | local func_b | ||
| 3286 | func_b = function() | ||
| 3287 | local _accum_0 = { } | ||
| 3288 | local _len_0 = 1 | ||
| 3289 | for i = 1, 10 do | ||
| 3290 | _accum_0[_len_0] = i | ||
| 3291 | _len_0 = _len_0 + 1 | ||
| 3292 | end | ||
| 3293 | return _accum_0 | ||
| 3294 | end | ||
| 3295 | print(func_a()) | ||
| 3296 | print(func_b()) | ||
| 3297 | for i = 10, 20 do | ||
| 3298 | print(i) | ||
| 3299 | end | ||
| 3300 | for k = 1, 15, 2 do | ||
| 3301 | print(k) | ||
| 3302 | end | ||
| 3303 | for key, value in pairs(object) do | ||
| 3304 | print(key, value) | ||
| 3305 | end | ||
| 3306 | local _list_0 = items | ||
| 3307 | for _index_0 = 2, 4 do | ||
| 3308 | local item = _list_0[_index_0] | ||
| 3309 | print(item) | ||
| 3310 | end | ||
| 3311 | local _list_0 = items | ||
| 3312 | for _index_0 = 1, #_list_0 do | ||
| 3313 | local item = _list_0[_index_0] | ||
| 3314 | print(item) | ||
| 3315 | end | ||
| 3316 | for j = 1, 10, 3 do | ||
| 3317 | print(j) | ||
| 3318 | end | ||
| 3319 | local doubled_evens | ||
| 3320 | local _accum_0 = { } | ||
| 3321 | local _len_0 = 1 | ||
| 3322 | for i = 1, 20 do | ||
| 3323 | if i % 2 == 0 then | ||
| 3324 | _accum_0[_len_0] = i * 2 | ||
| 3325 | _len_0 = _len_0 + 1 | ||
| 3326 | else | ||
| 3327 | _accum_0[_len_0] = i | ||
| 3328 | _len_0 = _len_0 + 1 | ||
| 3329 | end | ||
| 3330 | end | ||
| 3331 | doubled_evens = _accum_0 | ||
| 3332 | local first_large | ||
| 3333 | local _accum_0 | ||
| 3334 | local _list_0 = numbers | ||
| 3335 | for _index_0 = 1, #_list_0 do | ||
| 3336 | local n = _list_0[_index_0] | ||
| 3337 | if n > 10 then | ||
| 3338 | _accum_0 = n | ||
| 3339 | break | ||
| 3340 | end | ||
| 3341 | end | ||
| 3342 | first_large = _accum_0 | ||
| 3343 | local func_a | ||
| 3344 | func_a = function() | ||
| 3345 | for i = 1, 10 do | ||
| 3346 | print(i) | ||
| 3347 | end | ||
| 3348 | end | ||
| 3349 | local func_b | ||
| 3350 | func_b = function() | ||
| 3351 | local _accum_0 = { } | ||
| 3352 | local _len_0 = 1 | ||
| 3353 | for i = 1, 10 do | ||
| 3354 | _accum_0[_len_0] = i | ||
| 3355 | _len_0 = _len_0 + 1 | ||
| 3356 | end | ||
| 3357 | return _accum_0 | ||
| 3358 | end | ||
| 3359 | print(func_a()) | ||
| 3360 | print(func_b()) | ||
| 3361 | local i = 0 | ||
| 3362 | while i < 10 do | ||
| 3363 | i = i + 1 | ||
| 3364 | if i % 2 == 0 then | ||
| 3365 | goto _continue_0 | ||
| 3366 | end | ||
| 3367 | print(i) | ||
| 3368 | ::_continue_0:: | ||
| 3369 | end | ||
| 3370 | local my_numbers = { | ||
| 3371 | 1, | ||
| 3372 | 2, | ||
| 3373 | 3, | ||
| 3374 | 4, | ||
| 3375 | 5, | ||
| 3376 | 6 | ||
| 3377 | } | ||
| 3378 | local odds | ||
| 3379 | local _accum_0 = { } | ||
| 3380 | local _len_0 = 1 | ||
| 3381 | for _index_0 = 1, #my_numbers do | ||
| 3382 | local x = my_numbers[_index_0] | ||
| 3383 | if x % 2 == 1 then | ||
| 3384 | goto _continue_0 | ||
| 3385 | end | ||
| 3386 | _accum_0[_len_0] = x | ||
| 3387 | _len_0 = _len_0 + 1 | ||
| 3388 | ::_continue_0:: | ||
| 3389 | end | ||
| 3390 | odds = _accum_0 | ||
| 3391 | local i = 0 | ||
| 3392 | while i < 10 do | ||
| 3393 | i = i + 1 | ||
| 3394 | if i % 2 == 0 then | ||
| 3395 | goto _continue_0 | ||
| 3396 | end | ||
| 3397 | print(i) | ||
| 3398 | ::_continue_0:: | ||
| 3399 | end | ||
| 3400 | local my_numbers = { | ||
| 3401 | 1, | ||
| 3402 | 2, | ||
| 3403 | 3, | ||
| 3404 | 4, | ||
| 3405 | 5, | ||
| 3406 | 6 | ||
| 3407 | } | ||
| 3408 | local odds | ||
| 3409 | local _accum_0 = { } | ||
| 3410 | local _len_0 = 1 | ||
| 3411 | for _index_0 = 1, #my_numbers do | ||
| 3412 | local x = my_numbers[_index_0] | ||
| 3413 | if x % 2 == 1 then | ||
| 3414 | goto _continue_0 | ||
| 3415 | end | ||
| 3416 | _accum_0[_len_0] = x | ||
| 3417 | _len_0 = _len_0 + 1 | ||
| 3418 | ::_continue_0:: | ||
| 3419 | end | ||
| 3420 | odds = _accum_0 | ||
| 3421 | local name = "Dan" | ||
| 3422 | if "Robert" == name then | ||
| 3423 | print("你是Robert") | ||
| 3424 | elseif "Dan" == name or "Daniel" == name then | ||
| 3425 | print("你的名字是Dan") | ||
| 3426 | else | ||
| 3427 | print("我不认识你,你的名字是" .. tostring(name)) | ||
| 3428 | end | ||
| 3429 | local b = 1 | ||
| 3430 | local next_number | ||
| 3431 | if 1 == b then | ||
| 3432 | next_number = 2 | ||
| 3433 | elseif 2 == b then | ||
| 3434 | next_number = 3 | ||
| 3435 | else | ||
| 3436 | next_number = error("数字数得太大了!") | ||
| 3437 | end | ||
| 3438 | local msg | ||
| 3439 | local _exp_0 = math.random(1, 5) | ||
| 3440 | if 1 == _exp_0 then | ||
| 3441 | msg = "你很幸运" | ||
| 3442 | elseif 2 == _exp_0 then | ||
| 3443 | msg = "你差点很幸运" | ||
| 3444 | else | ||
| 3445 | msg = "不太幸运" | ||
| 3446 | end | ||
| 3447 | do | ||
| 3448 | local _exp_0 = math.random(1, 5) | ||
| 3449 | if 1 == _exp_0 then | ||
| 3450 | print("你很幸运") | ||
| 3451 | else | ||
| 3452 | print("不太幸运") | ||
| 3453 | end | ||
| 3454 | end | ||
| 3455 | local _exp_0 = math.random(1, 5) | ||
| 3456 | if 1 == _exp_0 then | ||
| 3457 | print("你很幸运") | ||
| 3458 | else | ||
| 3459 | print("不太幸运") | ||
| 3460 | end | ||
| 3461 | local items = { | ||
| 3462 | { | ||
| 3463 | x = 100, | ||
| 3464 | y = 200 | ||
| 3465 | }, | ||
| 3466 | { | ||
| 3467 | width = 300, | ||
| 3468 | height = 400 | ||
| 3469 | } | ||
| 3470 | } | ||
| 3471 | for _index_0 = 1, #items do | ||
| 3472 | local item = items[_index_0] | ||
| 3473 | local _type_0 = type(item) | ||
| 3474 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3475 | local _match_0 = false | ||
| 3476 | if _tab_0 then | ||
| 3477 | local x = item.x | ||
| 3478 | local y = item.y | ||
| 3479 | if x ~= nil and y ~= nil then | ||
| 3480 | _match_0 = true | ||
| 3481 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3482 | end | ||
| 3483 | end | ||
| 3484 | if not _match_0 then | ||
| 3485 | if _tab_0 then | ||
| 3486 | local width = item.width | ||
| 3487 | local height = item.height | ||
| 3488 | if width ~= nil and height ~= nil then | ||
| 3489 | print("尺寸 " .. tostring(width) .. ", " .. tostring(height)) | ||
| 3490 | end | ||
| 3491 | end | ||
| 3492 | end | ||
| 3493 | end | ||
| 3494 | local item = { } | ||
| 3495 | local x, y = item.pos.x, item.pos.y | ||
| 3496 | if x == nil then | ||
| 3497 | x = 50 | ||
| 3498 | end | ||
| 3499 | if y == nil then | ||
| 3500 | y = 200 | ||
| 3501 | end | ||
| 3502 | local _type_0 = type(item) | ||
| 3503 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3504 | if _tab_0 then | ||
| 3505 | do | ||
| 3506 | local _obj_0 = item.pos | ||
| 3507 | local _type_1 = type(_obj_0) | ||
| 3508 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3509 | x = _obj_0.x | ||
| 3510 | end | ||
| 3511 | end | ||
| 3512 | do | ||
| 3513 | local _obj_0 = item.pos | ||
| 3514 | local _type_1 = type(_obj_0) | ||
| 3515 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3516 | y = _obj_0.y | ||
| 3517 | end | ||
| 3518 | end | ||
| 3519 | if x == nil then | ||
| 3520 | x = 50 | ||
| 3521 | end | ||
| 3522 | if y == nil then | ||
| 3523 | y = 200 | ||
| 3524 | end | ||
| 3525 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3526 | end | ||
| 3527 | local _exp_0 = tb | ||
| 3528 | local _type_0 = type(_exp_0) | ||
| 3529 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3530 | local _match_0 = false | ||
| 3531 | if _tab_0 then | ||
| 3532 | if 1 == _exp_0[1] and 2 == _exp_0[2] and 3 == _exp_0[3] then | ||
| 3533 | _match_0 = true | ||
| 3534 | print("1, 2, 3") | ||
| 3535 | end | ||
| 3536 | end | ||
| 3537 | if not _match_0 then | ||
| 3538 | local _match_1 = false | ||
| 3539 | if _tab_0 then | ||
| 3540 | local b = _exp_0[2] | ||
| 3541 | if 1 == _exp_0[1] and b ~= nil and 3 == _exp_0[3] then | ||
| 3542 | _match_1 = true | ||
| 3543 | print("1, " .. tostring(b) .. ", 3") | ||
| 3544 | end | ||
| 3545 | end | ||
| 3546 | if not _match_1 then | ||
| 3547 | if _tab_0 then | ||
| 3548 | local b = _exp_0[3] | ||
| 3549 | if b == nil then | ||
| 3550 | b = 3 | ||
| 3551 | end | ||
| 3552 | if 1 == _exp_0[1] and 2 == _exp_0[2] then | ||
| 3553 | print("1, 2, " .. tostring(b)) | ||
| 3554 | end | ||
| 3555 | end | ||
| 3556 | end | ||
| 3557 | end | ||
| 3558 | local _exp_0 = tb | ||
| 3559 | local _type_0 = type(_exp_0) | ||
| 3560 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3561 | local _match_0 = false | ||
| 3562 | if _tab_0 then | ||
| 3563 | local result = _exp_0.result | ||
| 3564 | if true == _exp_0.success and result ~= nil then | ||
| 3565 | _match_0 = true | ||
| 3566 | print("成功", result) | ||
| 3567 | end | ||
| 3568 | end | ||
| 3569 | if not _match_0 then | ||
| 3570 | local _match_1 = false | ||
| 3571 | if _tab_0 then | ||
| 3572 | if false == _exp_0.success then | ||
| 3573 | _match_1 = true | ||
| 3574 | print("失败", result) | ||
| 3575 | end | ||
| 3576 | end | ||
| 3577 | if not _match_1 then | ||
| 3578 | print("无效值") | ||
| 3579 | end | ||
| 3580 | end | ||
| 3581 | local _exp_0 = tb | ||
| 3582 | local _type_0 = type(_exp_0) | ||
| 3583 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3584 | local _match_0 = false | ||
| 3585 | if _tab_0 then | ||
| 3586 | local content | ||
| 3587 | do | ||
| 3588 | local _obj_0 = _exp_0.data | ||
| 3589 | local _type_1 = type(_obj_0) | ||
| 3590 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3591 | content = _obj_0.content | ||
| 3592 | end | ||
| 3593 | end | ||
| 3594 | local _val_0 | ||
| 3595 | do | ||
| 3596 | local _obj_0 = _exp_0.data | ||
| 3597 | if _obj_0 ~= nil then | ||
| 3598 | _val_0 = _obj_0.type | ||
| 3599 | end | ||
| 3600 | end | ||
| 3601 | if "success" == _val_0 and content ~= nil then | ||
| 3602 | _match_0 = true | ||
| 3603 | print("成功", content) | ||
| 3604 | end | ||
| 3605 | end | ||
| 3606 | if not _match_0 then | ||
| 3607 | local _match_1 = false | ||
| 3608 | if _tab_0 then | ||
| 3609 | local content | ||
| 3610 | do | ||
| 3611 | local _obj_0 = _exp_0.data | ||
| 3612 | local _type_1 = type(_obj_0) | ||
| 3613 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3614 | content = _obj_0.content | ||
| 3615 | end | ||
| 3616 | end | ||
| 3617 | local _val_0 | ||
| 3618 | do | ||
| 3619 | local _obj_0 = _exp_0.data | ||
| 3620 | if _obj_0 ~= nil then | ||
| 3621 | _val_0 = _obj_0.type | ||
| 3622 | end | ||
| 3623 | end | ||
| 3624 | if "error" == _val_0 and content ~= nil then | ||
| 3625 | _match_1 = true | ||
| 3626 | print("失败", content) | ||
| 3627 | end | ||
| 3628 | end | ||
| 3629 | if not _match_1 then | ||
| 3630 | print("无效值") | ||
| 3631 | end | ||
| 3632 | end | ||
| 3633 | local _exp_0 = tb | ||
| 3634 | local _type_0 = type(_exp_0) | ||
| 3635 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3636 | if _tab_0 then | ||
| 3637 | local fourth = _exp_0[4] | ||
| 3638 | local _val_0 | ||
| 3639 | do | ||
| 3640 | local _obj_0 = _exp_0[1] | ||
| 3641 | if _obj_0 ~= nil then | ||
| 3642 | _val_0 = _obj_0.a | ||
| 3643 | end | ||
| 3644 | end | ||
| 3645 | local _val_1 | ||
| 3646 | do | ||
| 3647 | local _obj_0 = _exp_0[1] | ||
| 3648 | if _obj_0 ~= nil then | ||
| 3649 | _val_1 = _obj_0.b | ||
| 3650 | end | ||
| 3651 | end | ||
| 3652 | local _val_2 | ||
| 3653 | do | ||
| 3654 | local _obj_0 = _exp_0[2] | ||
| 3655 | if _obj_0 ~= nil then | ||
| 3656 | _val_2 = _obj_0.a | ||
| 3657 | end | ||
| 3658 | end | ||
| 3659 | local _val_3 | ||
| 3660 | do | ||
| 3661 | local _obj_0 = _exp_0[2] | ||
| 3662 | if _obj_0 ~= nil then | ||
| 3663 | _val_3 = _obj_0.b | ||
| 3664 | end | ||
| 3665 | end | ||
| 3666 | local _val_4 | ||
| 3667 | do | ||
| 3668 | local _obj_0 = _exp_0[3] | ||
| 3669 | if _obj_0 ~= nil then | ||
| 3670 | _val_4 = _obj_0.a | ||
| 3671 | end | ||
| 3672 | end | ||
| 3673 | local _val_5 | ||
| 3674 | do | ||
| 3675 | local _obj_0 = _exp_0[3] | ||
| 3676 | if _obj_0 ~= nil then | ||
| 3677 | _val_5 = _obj_0.b | ||
| 3678 | end | ||
| 3679 | end | ||
| 3680 | if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then | ||
| 3681 | print("匹配成功", fourth) | ||
| 3682 | end | ||
| 3683 | end | ||
| 3684 | local segments = { | ||
| 3685 | "admin", | ||
| 3686 | "users", | ||
| 3687 | "logs", | ||
| 3688 | "view" | ||
| 3689 | } | ||
| 3690 | local _type_0 = type(segments) | ||
| 3691 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3692 | if _tab_0 then | ||
| 3693 | local groups | ||
| 3694 | do | ||
| 3695 | local _accum_0 = { } | ||
| 3696 | local _len_0 = 1 | ||
| 3697 | local _max_0 = #segments + -3 + 1 | ||
| 3698 | for _index_0 = 1, _max_0 do | ||
| 3699 | local _item_0 = segments[_index_0] | ||
| 3700 | _accum_0[_len_0] = _item_0 | ||
| 3701 | _len_0 = _len_0 + 1 | ||
| 3702 | end | ||
| 3703 | groups = _accum_0 | ||
| 3704 | end | ||
| 3705 | local resource = segments[#segments - 1] | ||
| 3706 | local action = segments[#segments] | ||
| 3707 | if resource ~= nil and action ~= nil then | ||
| 3708 | print("Group:", groups) | ||
| 3709 | print("Resource:", resource) | ||
| 3710 | print("Action:", action) | ||
| 3711 | end | ||
| 3712 | end | ||
| 3713 | local name = "Dan" | ||
| 3714 | if "Robert" == name then | ||
| 3715 | print("你是Robert") | ||
| 3716 | elseif "Dan" == name or "Daniel" == name then | ||
| 3717 | print("你的名字是Dan") | ||
| 3718 | else | ||
| 3719 | print("我不认识你,你的名字是" .. tostring(name)) | ||
| 3720 | end | ||
| 3721 | local b = 1 | ||
| 3722 | local next_number | ||
| 3723 | if 1 == b then | ||
| 3724 | next_number = 2 | ||
| 3725 | elseif 2 == b then | ||
| 3726 | next_number = 3 | ||
| 3727 | else | ||
| 3728 | next_number = error("数字数得太大了!") | ||
| 3729 | end | ||
| 3730 | local msg | ||
| 3731 | local _exp_0 = math.random(1, 5) | ||
| 3732 | if 1 == _exp_0 then | ||
| 3733 | msg = "你很幸运" | ||
| 3734 | elseif 2 == _exp_0 then | ||
| 3735 | msg = "你差点很幸运" | ||
| 3736 | else | ||
| 3737 | msg = "不太幸运" | ||
| 3738 | end | ||
| 3739 | do | ||
| 3740 | local _exp_0 = math.random(1, 5) | ||
| 3741 | if 1 == _exp_0 then | ||
| 3742 | print("你很幸运") | ||
| 3743 | else | ||
| 3744 | print("不太幸运") | ||
| 3745 | end | ||
| 3746 | end | ||
| 3747 | local _exp_0 = math.random(1, 5) | ||
| 3748 | if 1 == _exp_0 then | ||
| 3749 | print("你很幸运") | ||
| 3750 | else | ||
| 3751 | print("不太幸运") | ||
| 3752 | end | ||
| 3753 | local items = { | ||
| 3754 | { | ||
| 3755 | x = 100, | ||
| 3756 | y = 200 | ||
| 3757 | }, | ||
| 3758 | { | ||
| 3759 | width = 300, | ||
| 3760 | height = 400 | ||
| 3761 | } | ||
| 3762 | } | ||
| 3763 | for _index_0 = 1, #items do | ||
| 3764 | local item = items[_index_0] | ||
| 3765 | local _type_0 = type(item) | ||
| 3766 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3767 | local _match_0 = false | ||
| 3768 | if _tab_0 then | ||
| 3769 | local x = item.x | ||
| 3770 | local y = item.y | ||
| 3771 | if x ~= nil and y ~= nil then | ||
| 3772 | _match_0 = true | ||
| 3773 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3774 | end | ||
| 3775 | end | ||
| 3776 | if not _match_0 then | ||
| 3777 | if _tab_0 then | ||
| 3778 | local width = item.width | ||
| 3779 | local height = item.height | ||
| 3780 | if width ~= nil and height ~= nil then | ||
| 3781 | print("尺寸 " .. tostring(width) .. ", " .. tostring(height)) | ||
| 3782 | end | ||
| 3783 | end | ||
| 3784 | end | ||
| 3785 | end | ||
| 3786 | local item = { } | ||
| 3787 | local x, y = item.pos.x, item.pos.y | ||
| 3788 | if x == nil then | ||
| 3789 | x = 50 | ||
| 3790 | end | ||
| 3791 | if y == nil then | ||
| 3792 | y = 200 | ||
| 3793 | end | ||
| 3794 | local _type_0 = type(item) | ||
| 3795 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3796 | if _tab_0 then | ||
| 3797 | do | ||
| 3798 | local _obj_0 = item.pos | ||
| 3799 | local _type_1 = type(_obj_0) | ||
| 3800 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3801 | x = _obj_0.x | ||
| 3802 | end | ||
| 3803 | end | ||
| 3804 | do | ||
| 3805 | local _obj_0 = item.pos | ||
| 3806 | local _type_1 = type(_obj_0) | ||
| 3807 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3808 | y = _obj_0.y | ||
| 3809 | end | ||
| 3810 | end | ||
| 3811 | if x == nil then | ||
| 3812 | x = 50 | ||
| 3813 | end | ||
| 3814 | if y == nil then | ||
| 3815 | y = 200 | ||
| 3816 | end | ||
| 3817 | print("Vec2 " .. tostring(x) .. ", " .. tostring(y)) | ||
| 3818 | end | ||
| 3819 | local _exp_0 = tb | ||
| 3820 | local _type_0 = type(_exp_0) | ||
| 3821 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3822 | local _match_0 = false | ||
| 3823 | if _tab_0 then | ||
| 3824 | if 1 == _exp_0[1] and 2 == _exp_0[2] and 3 == _exp_0[3] then | ||
| 3825 | _match_0 = true | ||
| 3826 | print("1, 2, 3") | ||
| 3827 | end | ||
| 3828 | end | ||
| 3829 | if not _match_0 then | ||
| 3830 | local _match_1 = false | ||
| 3831 | if _tab_0 then | ||
| 3832 | local b = _exp_0[2] | ||
| 3833 | if 1 == _exp_0[1] and b ~= nil and 3 == _exp_0[3] then | ||
| 3834 | _match_1 = true | ||
| 3835 | print("1, " .. tostring(b) .. ", 3") | ||
| 3836 | end | ||
| 3837 | end | ||
| 3838 | if not _match_1 then | ||
| 3839 | if _tab_0 then | ||
| 3840 | local b = _exp_0[3] | ||
| 3841 | if b == nil then | ||
| 3842 | b = 3 | ||
| 3843 | end | ||
| 3844 | if 1 == _exp_0[1] and 2 == _exp_0[2] then | ||
| 3845 | print("1, 2, " .. tostring(b)) | ||
| 3846 | end | ||
| 3847 | end | ||
| 3848 | end | ||
| 3849 | end | ||
| 3850 | local _exp_0 = tb | ||
| 3851 | local _type_0 = type(_exp_0) | ||
| 3852 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3853 | local _match_0 = false | ||
| 3854 | if _tab_0 then | ||
| 3855 | local result = _exp_0.result | ||
| 3856 | if true == _exp_0.success and result ~= nil then | ||
| 3857 | _match_0 = true | ||
| 3858 | print("成功", result) | ||
| 3859 | end | ||
| 3860 | end | ||
| 3861 | if not _match_0 then | ||
| 3862 | local _match_1 = false | ||
| 3863 | if _tab_0 then | ||
| 3864 | if false == _exp_0.success then | ||
| 3865 | _match_1 = true | ||
| 3866 | print("失败", result) | ||
| 3867 | end | ||
| 3868 | end | ||
| 3869 | if not _match_1 then | ||
| 3870 | print("无效值") | ||
| 3871 | end | ||
| 3872 | end | ||
| 3873 | local _exp_0 = tb | ||
| 3874 | local _type_0 = type(_exp_0) | ||
| 3875 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3876 | local _match_0 = false | ||
| 3877 | if _tab_0 then | ||
| 3878 | local content | ||
| 3879 | do | ||
| 3880 | local _obj_0 = _exp_0.data | ||
| 3881 | local _type_1 = type(_obj_0) | ||
| 3882 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3883 | content = _obj_0.content | ||
| 3884 | end | ||
| 3885 | end | ||
| 3886 | local _val_0 | ||
| 3887 | do | ||
| 3888 | local _obj_0 = _exp_0.data | ||
| 3889 | if _obj_0 ~= nil then | ||
| 3890 | _val_0 = _obj_0.type | ||
| 3891 | end | ||
| 3892 | end | ||
| 3893 | if "success" == _val_0 and content ~= nil then | ||
| 3894 | _match_0 = true | ||
| 3895 | print("成功", content) | ||
| 3896 | end | ||
| 3897 | end | ||
| 3898 | if not _match_0 then | ||
| 3899 | local _match_1 = false | ||
| 3900 | if _tab_0 then | ||
| 3901 | local content | ||
| 3902 | do | ||
| 3903 | local _obj_0 = _exp_0.data | ||
| 3904 | local _type_1 = type(_obj_0) | ||
| 3905 | if "table" == _type_1 or "userdata" == _type_1 then | ||
| 3906 | content = _obj_0.content | ||
| 3907 | end | ||
| 3908 | end | ||
| 3909 | local _val_0 | ||
| 3910 | do | ||
| 3911 | local _obj_0 = _exp_0.data | ||
| 3912 | if _obj_0 ~= nil then | ||
| 3913 | _val_0 = _obj_0.type | ||
| 3914 | end | ||
| 3915 | end | ||
| 3916 | if "error" == _val_0 and content ~= nil then | ||
| 3917 | _match_1 = true | ||
| 3918 | print("失败", content) | ||
| 3919 | end | ||
| 3920 | end | ||
| 3921 | if not _match_1 then | ||
| 3922 | print("无效值") | ||
| 3923 | end | ||
| 3924 | end | ||
| 3925 | local _exp_0 = tb | ||
| 3926 | local _type_0 = type(_exp_0) | ||
| 3927 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3928 | if _tab_0 then | ||
| 3929 | local fourth = _exp_0[4] | ||
| 3930 | local _val_0 | ||
| 3931 | do | ||
| 3932 | local _obj_0 = _exp_0[1] | ||
| 3933 | if _obj_0 ~= nil then | ||
| 3934 | _val_0 = _obj_0.a | ||
| 3935 | end | ||
| 3936 | end | ||
| 3937 | local _val_1 | ||
| 3938 | do | ||
| 3939 | local _obj_0 = _exp_0[1] | ||
| 3940 | if _obj_0 ~= nil then | ||
| 3941 | _val_1 = _obj_0.b | ||
| 3942 | end | ||
| 3943 | end | ||
| 3944 | local _val_2 | ||
| 3945 | do | ||
| 3946 | local _obj_0 = _exp_0[2] | ||
| 3947 | if _obj_0 ~= nil then | ||
| 3948 | _val_2 = _obj_0.a | ||
| 3949 | end | ||
| 3950 | end | ||
| 3951 | local _val_3 | ||
| 3952 | do | ||
| 3953 | local _obj_0 = _exp_0[2] | ||
| 3954 | if _obj_0 ~= nil then | ||
| 3955 | _val_3 = _obj_0.b | ||
| 3956 | end | ||
| 3957 | end | ||
| 3958 | local _val_4 | ||
| 3959 | do | ||
| 3960 | local _obj_0 = _exp_0[3] | ||
| 3961 | if _obj_0 ~= nil then | ||
| 3962 | _val_4 = _obj_0.a | ||
| 3963 | end | ||
| 3964 | end | ||
| 3965 | local _val_5 | ||
| 3966 | do | ||
| 3967 | local _obj_0 = _exp_0[3] | ||
| 3968 | if _obj_0 ~= nil then | ||
| 3969 | _val_5 = _obj_0.b | ||
| 3970 | end | ||
| 3971 | end | ||
| 3972 | if 1 == _val_0 and 2 == _val_1 and 3 == _val_2 and 4 == _val_3 and 5 == _val_4 and 6 == _val_5 and fourth ~= nil then | ||
| 3973 | print("匹配成功", fourth) | ||
| 3974 | end | ||
| 3975 | end | ||
| 3976 | local segments = { | ||
| 3977 | "admin", | ||
| 3978 | "users", | ||
| 3979 | "logs", | ||
| 3980 | "view" | ||
| 3981 | } | ||
| 3982 | local _type_0 = type(segments) | ||
| 3983 | local _tab_0 = "table" == _type_0 or "userdata" == _type_0 | ||
| 3984 | if _tab_0 then | ||
| 3985 | local groups | ||
| 3986 | do | ||
| 3987 | local _accum_0 = { } | ||
| 3988 | local _len_0 = 1 | ||
| 3989 | local _max_0 = #segments + -3 + 1 | ||
| 3990 | for _index_0 = 1, _max_0 do | ||
| 3991 | local _item_0 = segments[_index_0] | ||
| 3992 | _accum_0[_len_0] = _item_0 | ||
| 3993 | _len_0 = _len_0 + 1 | ||
| 3994 | end | ||
| 3995 | groups = _accum_0 | ||
| 3996 | end | ||
| 3997 | local resource = segments[#segments - 1] | ||
| 3998 | local action = segments[#segments] | ||
| 3999 | if resource ~= nil and action ~= nil then | ||
| 4000 | print("Group:", groups) | ||
| 4001 | print("Resource:", resource) | ||
| 4002 | print("Action:", action) | ||
| 4003 | end | ||
| 4004 | end | ||
| 4005 | local i = 10 | ||
| 4006 | while i > 0 do | ||
| 4007 | print(i) | ||
| 4008 | i = i - 1 | ||
| 4009 | end | ||
| 4010 | while running == true do | ||
| 4011 | my_function() | ||
| 4012 | end | ||
| 4013 | local i = 10 | ||
| 4014 | while not (i == 0) do | ||
| 4015 | print(i) | ||
| 4016 | i = i - 1 | ||
| 4017 | end | ||
| 4018 | while not (running == false) do | ||
| 4019 | my_function() | ||
| 4020 | end | ||
| 4021 | local i = 10 | ||
| 4022 | repeat | ||
| 4023 | print(i) | ||
| 4024 | i = i - 1 | ||
| 4025 | until i == 0 | ||
| 4026 | local i = 10 | ||
| 4027 | while i > 0 do | ||
| 4028 | print(i) | ||
| 4029 | i = i - 1 | ||
| 4030 | end | ||
| 4031 | while running == true do | ||
| 4032 | my_function() | ||
| 4033 | end | ||
| 4034 | local i = 10 | ||
| 4035 | while not (i == 0) do | ||
| 4036 | print(i) | ||
| 4037 | i = i - 1 | ||
| 4038 | end | ||
| 4039 | while not (running == false) do | ||
| 4040 | my_function() | ||
| 4041 | end | ||
| 4042 | local i = 10 | ||
| 4043 | repeat | ||
| 4044 | print(i) | ||
| 4045 | i = i - 1 | ||
| 4046 | until i == 0 | ||
| 4047 | local my_object = { | ||
| 4048 | value = 1000, | ||
| 4049 | write = function(self) | ||
| 4050 | return print("值为:", self.value) | ||
| 4051 | end | ||
| 4052 | } | ||
| 4053 | local run_callback | ||
| 4054 | run_callback = function(func) | ||
| 4055 | print("运行回调...") | ||
| 4056 | return func() | ||
| 4057 | end | ||
| 4058 | run_callback(my_object.write) | ||
| 4059 | run_callback((function() | ||
| 4060 | local _base_0 = my_object | ||
| 4061 | local _fn_0 = _base_0.write | ||
| 4062 | return _fn_0 and function(...) | ||
| 4063 | return _fn_0(_base_0, ...) | ||
| 4064 | end | ||
| 4065 | end)()) | ||
| 4066 | local my_object = { | ||
| 4067 | value = 1000, | ||
| 4068 | write = function(self) | ||
| 4069 | return print("值为:", self.value) | ||
| 4070 | end | ||
| 4071 | } | ||
| 4072 | local run_callback | ||
| 4073 | run_callback = function(func) | ||
| 4074 | print("运行回调...") | ||
| 4075 | return func() | ||
| 4076 | end | ||
| 4077 | run_callback(my_object.write) | ||
| 4078 | run_callback((function() | ||
| 4079 | local _base_0 = my_object | ||
| 4080 | local _fn_0 = _base_0.write | ||
| 4081 | return _fn_0 and function(...) | ||
| 4082 | return _fn_0(_base_0, ...) | ||
| 4083 | end | ||
| 4084 | end)()) | ||
| 4085 | f(function(x) | ||
| 4086 | return print("hello" .. x) | ||
| 4087 | end) | ||
| 4088 | f(function(self) | ||
| 4089 | return print(self.value) | ||
| 4090 | end) | ||
| 4091 | map(function(x) | ||
| 4092 | return x * 2 | ||
| 4093 | end, { | ||
| 4094 | 1, | ||
| 4095 | 2, | ||
| 4096 | 3 | ||
| 4097 | }) | ||
| 4098 | local result, msg | ||
| 4099 | do | ||
| 4100 | result, msg = readAsync("文件名.txt", function(data) | ||
| 4101 | print(data) | ||
| 4102 | return processAsync(data, function(info) | ||
| 4103 | return check(info) | ||
| 4104 | end) | ||
| 4105 | end) | ||
| 4106 | end | ||
| 4107 | print(result, msg) | ||
| 4108 | f(function(x) | ||
| 4109 | return print("hello" .. x) | ||
| 4110 | end) | ||
| 4111 | f(function(self) | ||
| 4112 | return print(self.value) | ||
| 4113 | end) | ||
| 4114 | map(function(x) | ||
| 4115 | return x * 2 | ||
| 4116 | end, { | ||
| 4117 | 1, | ||
| 4118 | 2, | ||
| 4119 | 3 | ||
| 4120 | }) | ||
| 4121 | local result, msg | ||
| 4122 | do | ||
| 4123 | result, msg = readAsync("文件名.txt", function(data) | ||
| 4124 | print(data) | ||
| 4125 | return processAsync(data, function(info) | ||
| 4126 | return check(info) | ||
| 4127 | end) | ||
| 4128 | end) | ||
| 4129 | end | ||
| 4130 | print(result, msg) | ||
| 4131 | local my_function | ||
| 4132 | my_function = function() end | ||
| 4133 | my_function() | ||
| 4134 | local func_a | ||
| 4135 | func_a = function() | ||
| 4136 | return print("你好,世界") | ||
| 4137 | end | ||
| 4138 | local func_b | ||
| 4139 | func_b = function() | ||
| 4140 | local value = 100 | ||
| 4141 | return print("这个值是:", value) | ||
| 4142 | end | ||
| 4143 | func_a() | ||
| 4144 | func_b() | ||
| 4145 | local sum | ||
| 4146 | sum = function(x, y) | ||
| 4147 | return print("数字的和", x + y) | ||
| 4148 | end | ||
| 4149 | sum(10, 20) | ||
| 4150 | print(sum(10, 20)) | ||
| 4151 | a(b(c("a", "b", "c"))) | ||
| 4152 | print("x:", sum(10, 20), "y:", sum(30, 40)) | ||
| 4153 | local sum | ||
| 4154 | sum = function(x, y) | ||
| 4155 | return x + y | ||
| 4156 | end | ||
| 4157 | print("数字的和是", sum(10, 20)) | ||
| 4158 | local sum | ||
| 4159 | sum = function(x, y) | ||
| 4160 | return x + y | ||
| 4161 | end | ||
| 4162 | local mystery | ||
| 4163 | mystery = function(x, y) | ||
| 4164 | return x + y, x - y | ||
| 4165 | end | ||
| 4166 | local a, b = mystery(10, 20) | ||
| 4167 | local func | ||
| 4168 | func = function(self, num) | ||
| 4169 | return self.value + num | ||
| 4170 | end | ||
| 4171 | local my_function | ||
| 4172 | my_function = function(name, height) | ||
| 4173 | if name == nil then | ||
| 4174 | name = "某物" | ||
| 4175 | end | ||
| 4176 | if height == nil then | ||
| 4177 | height = 100 | ||
| 4178 | end | ||
| 4179 | print("你好,我是", name) | ||
| 4180 | return print("我的高度是", height) | ||
| 4181 | end | ||
| 4182 | local some_args | ||
| 4183 | some_args = function(x, y) | ||
| 4184 | if x == nil then | ||
| 4185 | x = 100 | ||
| 4186 | end | ||
| 4187 | if y == nil then | ||
| 4188 | y = x + 1000 | ||
| 4189 | end | ||
| 4190 | return print(x + y) | ||
| 4191 | end | ||
| 4192 | local a = x - 10 | ||
| 4193 | local b = x - 10 | ||
| 4194 | local c = x(-y) | ||
| 4195 | local d = x - z | ||
| 4196 | local x = func("hello") + 100 | ||
| 4197 | local y = func("hello" + 100) | ||
| 4198 | my_func(5, 4, 3, 8, 9, 10) | ||
| 4199 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) | ||
| 4200 | my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) | ||
| 4201 | local x = { | ||
| 4202 | 1, | ||
| 4203 | 2, | ||
| 4204 | 3, | ||
| 4205 | 4, | ||
| 4206 | a_func(4, 5, 5, 6), | ||
| 4207 | 8, | ||
| 4208 | 9, | ||
| 4209 | 10 | ||
| 4210 | } | ||
| 4211 | local y = { | ||
| 4212 | my_func(1, 2, 3, 4, 5), | ||
| 4213 | 5, | ||
| 4214 | 6, | ||
| 4215 | 7 | ||
| 4216 | } | ||
| 4217 | if func(1, 2, 3, "你好", "世界") then | ||
| 4218 | print("你好") | ||
| 4219 | print("我在if内部") | ||
| 4220 | end | ||
| 4221 | if func(1, 2, 3, "你好", "世界") then | ||
| 4222 | print("hello") | ||
| 4223 | print("我在if内部") | ||
| 4224 | end | ||
| 4225 | local f1 | ||
| 4226 | f1 = function(_arg_0) | ||
| 4227 | local a, b, c | ||
| 4228 | a, b, c = _arg_0.a, _arg_0.b, _arg_0.c | ||
| 4229 | return print(a, b, c) | ||
| 4230 | end | ||
| 4231 | f1({ | ||
| 4232 | a = 1, | ||
| 4233 | b = "2", | ||
| 4234 | c = { } | ||
| 4235 | }) | ||
| 4236 | local f2 | ||
| 4237 | f2 = function(_arg_0, c) | ||
| 4238 | local a1, b | ||
| 4239 | a1, b = _arg_0.a, _arg_0.b | ||
| 4240 | if a1 == nil then | ||
| 4241 | a1 = 123 | ||
| 4242 | end | ||
| 4243 | if b == nil then | ||
| 4244 | b = 'abc' | ||
| 4245 | end | ||
| 4246 | if c == nil then | ||
| 4247 | c = { } | ||
| 4248 | end | ||
| 4249 | return print(a1, b, c) | ||
| 4250 | end | ||
| 4251 | local arg1 = { | ||
| 4252 | a = 0 | ||
| 4253 | } | ||
| 4254 | f2(arg1, arg2) | ||
| 4255 | local findFirstEven | ||
| 4256 | findFirstEven = function(list) | ||
| 4257 | for _index_0 = 1, #list do | ||
| 4258 | local item = list[_index_0] | ||
| 4259 | if type(item) == "table" then | ||
| 4260 | for _index_1 = 1, #item do | ||
| 4261 | local sub = item[_index_1] | ||
| 4262 | if sub % 2 == 0 then | ||
| 4263 | return sub | ||
| 4264 | end | ||
| 4265 | end | ||
| 4266 | end | ||
| 4267 | end | ||
| 4268 | return nil | ||
| 4269 | end | ||
| 4270 | local findFirstEven | ||
| 4271 | findFirstEven = function(list) | ||
| 4272 | for _index_0 = 1, #list do | ||
| 4273 | local item = list[_index_0] | ||
| 4274 | if type(item) == "table" then | ||
| 4275 | for _index_1 = 1, #item do | ||
| 4276 | local sub = item[_index_1] | ||
| 4277 | if sub % 2 == 0 then | ||
| 4278 | return sub | ||
| 4279 | end | ||
| 4280 | end | ||
| 4281 | end | ||
| 4282 | end | ||
| 4283 | return nil | ||
| 4284 | end | ||
| 4285 | local f | ||
| 4286 | f = function(...) | ||
| 4287 | local t = { | ||
| 4288 | n = select("#", ...), | ||
| 4289 | ... | ||
| 4290 | } | ||
| 4291 | print("参数个数:", t.n) | ||
| 4292 | print("表长度:", #t) | ||
| 4293 | for i = 1, t.n do | ||
| 4294 | print(t[i]) | ||
| 4295 | end | ||
| 4296 | end | ||
| 4297 | f(1, 2, 3) | ||
| 4298 | f("a", "b", "c", "d") | ||
| 4299 | f() | ||
| 4300 | local process | ||
| 4301 | process = function(...) | ||
| 4302 | local args = { | ||
| 4303 | n = select("#", ...), | ||
| 4304 | ... | ||
| 4305 | } | ||
| 4306 | local sum = 0 | ||
| 4307 | for i = 1, args.n do | ||
| 4308 | if args[i] ~= nil and type(args[i]) == "number" then | ||
| 4309 | sum = sum + args[i] | ||
| 4310 | end | ||
| 4311 | end | ||
| 4312 | return sum | ||
| 4313 | end | ||
| 4314 | process(1, nil, 3, nil, 5) | ||
| 4315 | local my_function | ||
| 4316 | my_function = function() end | ||
| 4317 | my_function() | ||
| 4318 | local func_a | ||
| 4319 | func_a = function() | ||
| 4320 | return print("你好,世界") | ||
| 4321 | end | ||
| 4322 | local func_b | ||
| 4323 | func_b = function() | ||
| 4324 | local value = 100 | ||
| 4325 | return print("这个值是:", value) | ||
| 4326 | end | ||
| 4327 | func_a() | ||
| 4328 | func_b() | ||
| 4329 | local sum | ||
| 4330 | sum = function(x, y) | ||
| 4331 | return print("数字的和", x + y) | ||
| 4332 | end | ||
| 4333 | sum(10, 20) | ||
| 4334 | print(sum(10, 20)) | ||
| 4335 | a(b(c("a", "b", "c"))) | ||
| 4336 | print("x:", sum(10, 20), "y:", sum(30, 40)) | ||
| 4337 | local sum | ||
| 4338 | sum = function(x, y) | ||
| 4339 | return x + y | ||
| 4340 | end | ||
| 4341 | print("数字的和是", sum(10, 20)) | ||
| 4342 | local sum | ||
| 4343 | sum = function(x, y) | ||
| 4344 | return x + y | ||
| 4345 | end | ||
| 4346 | local mystery | ||
| 4347 | mystery = function(x, y) | ||
| 4348 | return x + y, x - y | ||
| 4349 | end | ||
| 4350 | local a, b = mystery(10, 20) | ||
| 4351 | local func | ||
| 4352 | func = function(self, num) | ||
| 4353 | return self.value + num | ||
| 4354 | end | ||
| 4355 | local my_function | ||
| 4356 | my_function = function(name, height) | ||
| 4357 | if name == nil then | ||
| 4358 | name = "某物" | ||
| 4359 | end | ||
| 4360 | if height == nil then | ||
| 4361 | height = 100 | ||
| 4362 | end | ||
| 4363 | print("你好,我是", name) | ||
| 4364 | return print("我的高度是", height) | ||
| 4365 | end | ||
| 4366 | local some_args | ||
| 4367 | some_args = function(x, y) | ||
| 4368 | if x == nil then | ||
| 4369 | x = 100 | ||
| 4370 | end | ||
| 4371 | if y == nil then | ||
| 4372 | y = x + 1000 | ||
| 4373 | end | ||
| 4374 | return print(x + y) | ||
| 4375 | end | ||
| 4376 | local a = x - 10 | ||
| 4377 | local b = x - 10 | ||
| 4378 | local c = x(-y) | ||
| 4379 | local d = x - z | ||
| 4380 | local x = func("hello") + 100 | ||
| 4381 | local y = func("hello" + 100) | ||
| 4382 | my_func(5, 4, 3, 8, 9, 10) | ||
| 4383 | cool_func(1, 2, 3, 4, 5, 6, 7, 8) | ||
| 4384 | my_func(5, 6, 7, 6, another_func(6, 7, 8, 9, 1, 2), 5, 4) | ||
| 4385 | local x = { | ||
| 4386 | 1, | ||
| 4387 | 2, | ||
| 4388 | 3, | ||
| 4389 | 4, | ||
| 4390 | a_func(4, 5, 5, 6), | ||
| 4391 | 8, | ||
| 4392 | 9, | ||
| 4393 | 10 | ||
| 4394 | } | ||
| 4395 | local y = { | ||
| 4396 | my_func(1, 2, 3, 4, 5), | ||
| 4397 | 5, | ||
| 4398 | 6, | ||
| 4399 | 7 | ||
| 4400 | } | ||
| 4401 | if func(1, 2, 3, "你好", "世界") then | ||
| 4402 | print("你好") | ||
| 4403 | print("我在if内部") | ||
| 4404 | end | ||
| 4405 | if func(1, 2, 3, "你好", "世界") then | ||
| 4406 | print("你好") | ||
| 4407 | print("我在if内部") | ||
| 4408 | end | ||
| 4409 | local f1 | ||
| 4410 | f1 = function(_arg_0) | ||
| 4411 | local a, b, c | ||
| 4412 | a, b, c = _arg_0.a, _arg_0.b, _arg_0.c | ||
| 4413 | return print(a, b, c) | ||
| 4414 | end | ||
| 4415 | f1({ | ||
| 4416 | a = 1, | ||
| 4417 | b = "2", | ||
| 4418 | c = { } | ||
| 4419 | }) | ||
| 4420 | local f2 | ||
| 4421 | f2 = function(_arg_0, c) | ||
| 4422 | local a1, b | ||
| 4423 | a1, b = _arg_0.a, _arg_0.b | ||
| 4424 | if a1 == nil then | ||
| 4425 | a1 = 123 | ||
| 4426 | end | ||
| 4427 | if b == nil then | ||
| 4428 | b = 'abc' | ||
| 4429 | end | ||
| 4430 | if c == nil then | ||
| 4431 | c = { } | ||
| 4432 | end | ||
| 4433 | return print(a1, b, c) | ||
| 4434 | end | ||
| 4435 | local arg1 = { | ||
| 4436 | a = 0 | ||
| 4437 | } | ||
| 4438 | f2(arg1, arg2) | ||
| 4439 | local findFirstEven | ||
| 4440 | findFirstEven = function(list) | ||
| 4441 | for _index_0 = 1, #list do | ||
| 4442 | local item = list[_index_0] | ||
| 4443 | if type(item) == "table" then | ||
| 4444 | for _index_1 = 1, #item do | ||
| 4445 | local sub = item[_index_1] | ||
| 4446 | if sub % 2 == 0 then | ||
| 4447 | return sub | ||
| 4448 | end | ||
| 4449 | end | ||
| 4450 | end | ||
| 4451 | end | ||
| 4452 | return nil | ||
| 4453 | end | ||
| 4454 | local findFirstEven | ||
| 4455 | findFirstEven = function(list) | ||
| 4456 | for _index_0 = 1, #list do | ||
| 4457 | local item = list[_index_0] | ||
| 4458 | if type(item) == "table" then | ||
| 4459 | for _index_1 = 1, #item do | ||
| 4460 | local sub = item[_index_1] | ||
| 4461 | if sub % 2 == 0 then | ||
| 4462 | return sub | ||
| 4463 | end | ||
| 4464 | end | ||
| 4465 | end | ||
| 4466 | end | ||
| 4467 | return nil | ||
| 4468 | end | ||
| 4469 | local f | ||
| 4470 | f = function(...) | ||
| 4471 | local t = { | ||
| 4472 | n = select("#", ...), | ||
| 4473 | ... | ||
| 4474 | } | ||
| 4475 | print("参数个数:", t.n) | ||
| 4476 | print("表长度:", #t) | ||
| 4477 | for i = 1, t.n do | ||
| 4478 | print(t[i]) | ||
| 4479 | end | ||
| 4480 | end | ||
| 4481 | f(1, 2, 3) | ||
| 4482 | f("a", "b", "c", "d") | ||
| 4483 | f() | ||
| 4484 | local process | ||
| 4485 | process = function(...) | ||
| 4486 | local args = { | ||
| 4487 | n = select("#", ...), | ||
| 4488 | ... | ||
| 4489 | } | ||
| 4490 | local sum = 0 | ||
| 4491 | for i = 1, args.n do | ||
| 4492 | if args[i] ~= nil and type(args[i]) == "number" then | ||
| 4493 | sum = sum + args[i] | ||
| 4494 | end | ||
| 4495 | end | ||
| 4496 | return sum | ||
| 4497 | end | ||
| 4498 | process(1, nil, 3, nil, 5) | ||
| 4499 | local a = 1 | ||
| 4500 | local b = 2 | ||
| 4501 | print(a + b) | ||
| 4502 | Rx.Observable.fromRange(1, 8):filter(function(x) | ||
| 4503 | return x % 2 == 0 | ||
| 4504 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | ||
| 4505 | return value .. '!' | ||
| 4506 | end):subscribe(print) | ||
| 4507 | local a = 1 | ||
| 4508 | local b = 2 | ||
| 4509 | print(a + b) | ||
| 4510 | Rx.Observable.fromRange(1, 8):filter(function(x) | ||
| 4511 | return x % 2 == 0 | ||
| 4512 | end):concat(Rx.Observable.of('who do we appreciate')):map(function(value) | ||
| 4513 | return value .. '!' | ||
| 4514 | end):subscribe(print) | ||
| 4515 | local str = strA .. strB .. strC | ||
| 4516 | func(3000, "192.168.1.1") | ||
| 4517 | local str = strA .. strB .. strC | ||
| 4518 | func(3000, "192.168.1.1") | ||
| 4519 | local a <const> = 123 | ||
| 4520 | local _ <close> = setmetatable({ }, { | ||
| 4521 | __close = function() | ||
| 4522 | return print("超出范围。") | ||
| 4523 | end | ||
| 4524 | }) | ||
| 4525 | local a, b, c, d | ||
| 4526 | local _obj_0 = tb | ||
| 4527 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] | ||
| 4528 | Constant = 123 | ||
| 4529 | local a <const> = 123 | ||
| 4530 | local _ <close> = setmetatable({ }, { | ||
| 4531 | __close = function() | ||
| 4532 | return print("超出范围。") | ||
| 4533 | end | ||
| 4534 | }) | ||
| 4535 | local a, b, c, d | ||
| 4536 | local _obj_0 = tb | ||
| 4537 | a, b, c, d = _obj_0.a, _obj_0.b, _obj_0[1], _obj_0[2] | ||
| 4538 | Constant = 123 | ||
| 4539 | if tb ~= nil then | ||
| 4540 | tb:func() | ||
| 4541 | end | ||
| 4542 | if tb ~= nil then | ||
| 4543 | tb:func() | ||
| 4544 | end | ||
| 4545 | print(1 < 2 and 2 <= 2 and 2 < 3 and 3 == 3 and 3 > 2 and 2 >= 1 and 1 == 1 and 1 < 3 and 3 ~= 5) | ||
| 4546 | local a = 5 | ||
| 4547 | print(1 <= a and a <= 10) | ||
| 4548 | local v | ||
| 4549 | v = function(x) | ||
| 4550 | print(x) | ||
| 4551 | return x | ||
| 4552 | end | ||
| 4553 | print((function() | ||
| 4554 | local _cond_0 = v(2) | ||
| 4555 | if not (v(1) < _cond_0) then | ||
| 4556 | return false | ||
| 4557 | else | ||
| 4558 | return _cond_0 <= v(3) | ||
| 4559 | end | ||
| 4560 | end)()) | ||
| 4561 | print((function() | ||
| 4562 | local _cond_0 = v(2) | ||
| 4563 | if not (v(1) > _cond_0) then | ||
| 4564 | return false | ||
| 4565 | else | ||
| 4566 | return _cond_0 <= v(3) | ||
| 4567 | end | ||
| 4568 | end)()) | ||
| 4569 | local tab = { } | ||
| 4570 | tab[#tab + 1] = "Value" | ||
| 4571 | local tbA = { | ||
| 4572 | 1, | ||
| 4573 | 2, | ||
| 4574 | 3 | ||
| 4575 | } | ||
| 4576 | local tbB = { | ||
| 4577 | 4, | ||
| 4578 | 5, | ||
| 4579 | 6 | ||
| 4580 | } | ||
| 4581 | local _len_0 = #tbA + 1 | ||
| 4582 | for _index_0 = 1, #tbB do | ||
| 4583 | local _elm_0 = tbB[_index_0] | ||
| 4584 | tbA[_len_0], _len_0 = _elm_0, _len_0 + 1 | ||
| 4585 | end | ||
| 4586 | local parts = { | ||
| 4587 | "shoulders", | ||
| 4588 | "knees" | ||
| 4589 | } | ||
| 4590 | local lyrics | ||
| 4591 | do | ||
| 4592 | local _tab_0 = { | ||
| 4593 | "head" | ||
| 4594 | } | ||
| 4595 | local _idx_0 = 1 | ||
| 4596 | for _key_0, _value_0 in pairs(parts) do | ||
| 4597 | if _idx_0 == _key_0 then | ||
| 4598 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4599 | _idx_0 = _idx_0 + 1 | ||
| 4600 | else | ||
| 4601 | _tab_0[_key_0] = _value_0 | ||
| 4602 | end | ||
| 4603 | end | ||
| 4604 | _tab_0[#_tab_0 + 1] = "and" | ||
| 4605 | _tab_0[#_tab_0 + 1] = "toes" | ||
| 4606 | lyrics = _tab_0 | ||
| 4607 | end | ||
| 4608 | local copy | ||
| 4609 | do | ||
| 4610 | local _tab_0 = { } | ||
| 4611 | local _idx_0 = 1 | ||
| 4612 | for _key_0, _value_0 in pairs(other) do | ||
| 4613 | if _idx_0 == _key_0 then | ||
| 4614 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4615 | _idx_0 = _idx_0 + 1 | ||
| 4616 | else | ||
| 4617 | _tab_0[_key_0] = _value_0 | ||
| 4618 | end | ||
| 4619 | end | ||
| 4620 | copy = _tab_0 | ||
| 4621 | end | ||
| 4622 | local a = { | ||
| 4623 | 1, | ||
| 4624 | 2, | ||
| 4625 | 3, | ||
| 4626 | x = 1 | ||
| 4627 | } | ||
| 4628 | local b = { | ||
| 4629 | 4, | ||
| 4630 | 5, | ||
| 4631 | y = 1 | ||
| 4632 | } | ||
| 4633 | local merge | ||
| 4634 | local _tab_0 = { } | ||
| 4635 | local _idx_0 = 1 | ||
| 4636 | for _key_0, _value_0 in pairs(a) do | ||
| 4637 | if _idx_0 == _key_0 then | ||
| 4638 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4639 | _idx_0 = _idx_0 + 1 | ||
| 4640 | else | ||
| 4641 | _tab_0[_key_0] = _value_0 | ||
| 4642 | end | ||
| 4643 | end | ||
| 4644 | local _idx_1 = 1 | ||
| 4645 | for _key_0, _value_0 in pairs(b) do | ||
| 4646 | if _idx_1 == _key_0 then | ||
| 4647 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4648 | _idx_1 = _idx_1 + 1 | ||
| 4649 | else | ||
| 4650 | _tab_0[_key_0] = _value_0 | ||
| 4651 | end | ||
| 4652 | end | ||
| 4653 | merge = _tab_0 | ||
| 4654 | local last | ||
| 4655 | do | ||
| 4656 | local _item_0 = data.items | ||
| 4657 | last = _item_0[#_item_0] | ||
| 4658 | end | ||
| 4659 | local second_last | ||
| 4660 | do | ||
| 4661 | local _item_0 = data.items | ||
| 4662 | second_last = _item_0[#_item_0 - 1] | ||
| 4663 | end | ||
| 4664 | local _obj_0 = data.items | ||
| 4665 | _obj_0[#_obj_0] = 1 | ||
| 4666 | local mt = { } | ||
| 4667 | local add | ||
| 4668 | add = function(self, right) | ||
| 4669 | return setmetatable({ | ||
| 4670 | value = self.value + right.value | ||
| 4671 | }, mt) | ||
| 4672 | end | ||
| 4673 | mt.__add = add | ||
| 4674 | local a = setmetatable({ | ||
| 4675 | value = 1 | ||
| 4676 | }, mt) | ||
| 4677 | local b = setmetatable({ | ||
| 4678 | value = 2 | ||
| 4679 | }, { | ||
| 4680 | __add = add | ||
| 4681 | }) | ||
| 4682 | local c = setmetatable({ | ||
| 4683 | value = 3 | ||
| 4684 | }, { | ||
| 4685 | __add = mt.__add | ||
| 4686 | }) | ||
| 4687 | local d = a + b + c | ||
| 4688 | print(d.value) | ||
| 4689 | local _ <close> = setmetatable({ }, { | ||
| 4690 | __close = function() | ||
| 4691 | return print("超出范围") | ||
| 4692 | end | ||
| 4693 | }) | ||
| 4694 | local tb = setmetatable({ }, { | ||
| 4695 | ["value"] = 123 | ||
| 4696 | }) | ||
| 4697 | getmetatable(tb).__index = getmetatable(tb) | ||
| 4698 | print(tb.value) | ||
| 4699 | setmetatable(tb, { | ||
| 4700 | __index = { | ||
| 4701 | item = "hello" | ||
| 4702 | } | ||
| 4703 | }) | ||
| 4704 | print(tb.item) | ||
| 4705 | local item, new, close, getter | ||
| 4706 | do | ||
| 4707 | local _obj_0 = tb | ||
| 4708 | item, new = _obj_0[1], _obj_0.new | ||
| 4709 | do | ||
| 4710 | local _obj_1 = getmetatable(_obj_0) | ||
| 4711 | close, getter = _obj_1.__close, _obj_1.__index | ||
| 4712 | end | ||
| 4713 | end | ||
| 4714 | print(item, new, close, getter) | ||
| 4715 | do | ||
| 4716 | local _obj_0 = func | ||
| 4717 | if _obj_0 ~= nil then | ||
| 4718 | _obj_0() | ||
| 4719 | end | ||
| 4720 | end | ||
| 4721 | print((function() | ||
| 4722 | local _obj_0 = abc | ||
| 4723 | if _obj_0 ~= nil then | ||
| 4724 | local _obj_1 = _obj_0["你好 世界"] | ||
| 4725 | if _obj_1 ~= nil then | ||
| 4726 | return _obj_1.xyz | ||
| 4727 | end | ||
| 4728 | return nil | ||
| 4729 | end | ||
| 4730 | return nil | ||
| 4731 | end)()) | ||
| 4732 | local x | ||
| 4733 | do | ||
| 4734 | local _obj_0 = tab | ||
| 4735 | if _obj_0 ~= nil then | ||
| 4736 | x = _obj_0.value | ||
| 4737 | end | ||
| 4738 | end | ||
| 4739 | local len = (function() | ||
| 4740 | local _obj_0 = utf8 | ||
| 4741 | if _obj_0 ~= nil then | ||
| 4742 | return _obj_0.len | ||
| 4743 | end | ||
| 4744 | return nil | ||
| 4745 | end)() or (function() | ||
| 4746 | local _obj_0 = string | ||
| 4747 | if _obj_0 ~= nil then | ||
| 4748 | return _obj_0.len | ||
| 4749 | end | ||
| 4750 | return nil | ||
| 4751 | end)() or function(o) | ||
| 4752 | return #o | ||
| 4753 | end | ||
| 4754 | if print and (x ~= nil) then | ||
| 4755 | print(x) | ||
| 4756 | end | ||
| 4757 | local _with_0 = io.open("test.txt", "w") | ||
| 4758 | if _with_0 ~= nil then | ||
| 4759 | _with_0:write("你好") | ||
| 4760 | _with_0:close() | ||
| 4761 | end | ||
| 4762 | print("你好") | ||
| 4763 | print(1, 2) | ||
| 4764 | print(1, 2, 3) | ||
| 4765 | print(render(emit(parse(extract(readFile("example.txt"), language, { }), language)))) | ||
| 4766 | local a, b, c, d | ||
| 4767 | if b ~= nil then | ||
| 4768 | a = b | ||
| 4769 | else | ||
| 4770 | if c ~= nil then | ||
| 4771 | a = c | ||
| 4772 | else | ||
| 4773 | a = d | ||
| 4774 | end | ||
| 4775 | end | ||
| 4776 | func((function() | ||
| 4777 | if a ~= nil then | ||
| 4778 | return a | ||
| 4779 | else | ||
| 4780 | return { } | ||
| 4781 | end | ||
| 4782 | end)()) | ||
| 4783 | if a == nil then | ||
| 4784 | a = false | ||
| 4785 | end | ||
| 4786 | local list = { | ||
| 4787 | 1, | ||
| 4788 | 2, | ||
| 4789 | 3 | ||
| 4790 | } | ||
| 4791 | func({ | ||
| 4792 | 1, | ||
| 4793 | 2, | ||
| 4794 | 3 | ||
| 4795 | }) | ||
| 4796 | local f | ||
| 4797 | f = function() | ||
| 4798 | return { | ||
| 4799 | 1, | ||
| 4800 | 2, | ||
| 4801 | 3 | ||
| 4802 | } | ||
| 4803 | end | ||
| 4804 | local tb = { | ||
| 4805 | name = "abc", | ||
| 4806 | values = { | ||
| 4807 | "a", | ||
| 4808 | "b", | ||
| 4809 | "c" | ||
| 4810 | }, | ||
| 4811 | objects = { | ||
| 4812 | { | ||
| 4813 | name = "a", | ||
| 4814 | value = 1, | ||
| 4815 | func = function(self) | ||
| 4816 | return self.value + 1 | ||
| 4817 | end, | ||
| 4818 | tb = { | ||
| 4819 | fieldA = 1 | ||
| 4820 | } | ||
| 4821 | }, | ||
| 4822 | { | ||
| 4823 | name = "b", | ||
| 4824 | value = 2, | ||
| 4825 | func = function(self) | ||
| 4826 | return self.value + 2 | ||
| 4827 | end, | ||
| 4828 | tb = { } | ||
| 4829 | } | ||
| 4830 | } | ||
| 4831 | } | ||
| 4832 | if tb ~= nil then | ||
| 4833 | tb:func() | ||
| 4834 | end | ||
| 4835 | if tb ~= nil then | ||
| 4836 | tb:func() | ||
| 4837 | end | ||
| 4838 | print(1 < 2 and 2 <= 2 and 2 < 3 and 3 == 3 and 3 > 2 and 2 >= 1 and 1 == 1 and 1 < 3 and 3 ~= 5) | ||
| 4839 | local a = 5 | ||
| 4840 | print(1 <= a and a <= 10) | ||
| 4841 | local v | ||
| 4842 | v = function(x) | ||
| 4843 | print(x) | ||
| 4844 | return x | ||
| 4845 | end | ||
| 4846 | print((function() | ||
| 4847 | local _cond_0 = v(2) | ||
| 4848 | if not (v(1) < _cond_0) then | ||
| 4849 | return false | ||
| 4850 | else | ||
| 4851 | return _cond_0 <= v(3) | ||
| 4852 | end | ||
| 4853 | end)()) | ||
| 4854 | print((function() | ||
| 4855 | local _cond_0 = v(2) | ||
| 4856 | if not (v(1) > _cond_0) then | ||
| 4857 | return false | ||
| 4858 | else | ||
| 4859 | return _cond_0 <= v(3) | ||
| 4860 | end | ||
| 4861 | end)()) | ||
| 4862 | local tab = { } | ||
| 4863 | tab[#tab + 1] = "Value" | ||
| 4864 | local tbA = { | ||
| 4865 | 1, | ||
| 4866 | 2, | ||
| 4867 | 3 | ||
| 4868 | } | ||
| 4869 | local tbB = { | ||
| 4870 | 4, | ||
| 4871 | 5, | ||
| 4872 | 6 | ||
| 4873 | } | ||
| 4874 | local _len_0 = #tbA + 1 | ||
| 4875 | for _index_0 = 1, #tbB do | ||
| 4876 | local _elm_0 = tbB[_index_0] | ||
| 4877 | tbA[_len_0], _len_0 = _elm_0, _len_0 + 1 | ||
| 4878 | end | ||
| 4879 | local parts = { | ||
| 4880 | "shoulders", | ||
| 4881 | "knees" | ||
| 4882 | } | ||
| 4883 | local lyrics | ||
| 4884 | do | ||
| 4885 | local _tab_0 = { | ||
| 4886 | "head" | ||
| 4887 | } | ||
| 4888 | local _idx_0 = 1 | ||
| 4889 | for _key_0, _value_0 in pairs(parts) do | ||
| 4890 | if _idx_0 == _key_0 then | ||
| 4891 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4892 | _idx_0 = _idx_0 + 1 | ||
| 4893 | else | ||
| 4894 | _tab_0[_key_0] = _value_0 | ||
| 4895 | end | ||
| 4896 | end | ||
| 4897 | _tab_0[#_tab_0 + 1] = "and" | ||
| 4898 | _tab_0[#_tab_0 + 1] = "toes" | ||
| 4899 | lyrics = _tab_0 | ||
| 4900 | end | ||
| 4901 | local copy | ||
| 4902 | do | ||
| 4903 | local _tab_0 = { } | ||
| 4904 | local _idx_0 = 1 | ||
| 4905 | for _key_0, _value_0 in pairs(other) do | ||
| 4906 | if _idx_0 == _key_0 then | ||
| 4907 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4908 | _idx_0 = _idx_0 + 1 | ||
| 4909 | else | ||
| 4910 | _tab_0[_key_0] = _value_0 | ||
| 4911 | end | ||
| 4912 | end | ||
| 4913 | copy = _tab_0 | ||
| 4914 | end | ||
| 4915 | local a = { | ||
| 4916 | 1, | ||
| 4917 | 2, | ||
| 4918 | 3, | ||
| 4919 | x = 1 | ||
| 4920 | } | ||
| 4921 | local b = { | ||
| 4922 | 4, | ||
| 4923 | 5, | ||
| 4924 | y = 1 | ||
| 4925 | } | ||
| 4926 | local merge | ||
| 4927 | local _tab_0 = { } | ||
| 4928 | local _idx_0 = 1 | ||
| 4929 | for _key_0, _value_0 in pairs(a) do | ||
| 4930 | if _idx_0 == _key_0 then | ||
| 4931 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4932 | _idx_0 = _idx_0 + 1 | ||
| 4933 | else | ||
| 4934 | _tab_0[_key_0] = _value_0 | ||
| 4935 | end | ||
| 4936 | end | ||
| 4937 | local _idx_1 = 1 | ||
| 4938 | for _key_0, _value_0 in pairs(b) do | ||
| 4939 | if _idx_1 == _key_0 then | ||
| 4940 | _tab_0[#_tab_0 + 1] = _value_0 | ||
| 4941 | _idx_1 = _idx_1 + 1 | ||
| 4942 | else | ||
| 4943 | _tab_0[_key_0] = _value_0 | ||
| 4944 | end | ||
| 4945 | end | ||
| 4946 | merge = _tab_0 | ||
| 4947 | local last | ||
| 4948 | do | ||
| 4949 | local _item_0 = data.items | ||
| 4950 | last = _item_0[#_item_0] | ||
| 4951 | end | ||
| 4952 | local second_last | ||
| 4953 | do | ||
| 4954 | local _item_0 = data.items | ||
| 4955 | second_last = _item_0[#_item_0 - 1] | ||
| 4956 | end | ||
| 4957 | local _obj_0 = data.items | ||
| 4958 | _obj_0[#_obj_0] = 1 | ||
| 4959 | local mt = { } | ||
| 4960 | local add | ||
| 4961 | add = function(self, right) | ||
| 4962 | return setmetatable({ | ||
| 4963 | value = self.value + right.value | ||
| 4964 | }, mt) | ||
| 4965 | end | ||
| 4966 | mt.__add = add | ||
| 4967 | local a = setmetatable({ | ||
| 4968 | value = 1 | ||
| 4969 | }, mt) | ||
| 4970 | local b = setmetatable({ | ||
| 4971 | value = 2 | ||
| 4972 | }, { | ||
| 4973 | __add = add | ||
| 4974 | }) | ||
| 4975 | local c = setmetatable({ | ||
| 4976 | value = 3 | ||
| 4977 | }, { | ||
| 4978 | __add = mt.__add | ||
| 4979 | }) | ||
| 4980 | local d = a + b + c | ||
| 4981 | print(d.value) | ||
| 4982 | local _ <close> = setmetatable({ }, { | ||
| 4983 | __close = function() | ||
| 4984 | return print("超出范围") | ||
| 4985 | end | ||
| 4986 | }) | ||
| 4987 | local tb = setmetatable({ }, { | ||
| 4988 | ["value"] = 123 | ||
| 4989 | }) | ||
| 4990 | getmetatable(tb).__index = getmetatable(tb) | ||
| 4991 | print(tb.value) | ||
| 4992 | setmetatable(tb, { | ||
| 4993 | __index = { | ||
| 4994 | item = "hello" | ||
| 4995 | } | ||
| 4996 | }) | ||
| 4997 | print(tb.item) | ||
| 4998 | local item, new, close, getter | ||
| 4999 | do | ||
| 5000 | local _obj_0 = tb | ||
| 5001 | item, new = _obj_0[1], _obj_0.new | ||
| 5002 | do | ||
| 5003 | local _obj_1 = getmetatable(_obj_0) | ||
| 5004 | close, getter = _obj_1.__close, _obj_1.__index | ||
| 5005 | end | ||
| 5006 | end | ||
| 5007 | print(item, new, close, getter) | ||
| 5008 | do | ||
| 5009 | local _obj_0 = func | ||
| 5010 | if _obj_0 ~= nil then | ||
| 5011 | _obj_0() | ||
| 5012 | end | ||
| 5013 | end | ||
| 5014 | print((function() | ||
| 5015 | local _obj_0 = abc | ||
| 5016 | if _obj_0 ~= nil then | ||
| 5017 | local _obj_1 = _obj_0["你好 世界"] | ||
| 5018 | if _obj_1 ~= nil then | ||
| 5019 | return _obj_1.xyz | ||
| 5020 | end | ||
| 5021 | return nil | ||
| 5022 | end | ||
| 5023 | return nil | ||
| 5024 | end)()) | ||
| 5025 | local x | ||
| 5026 | do | ||
| 5027 | local _obj_0 = tab | ||
| 5028 | if _obj_0 ~= nil then | ||
| 5029 | x = _obj_0.value | ||
| 5030 | end | ||
| 5031 | end | ||
| 5032 | local len = (function() | ||
| 5033 | local _obj_0 = utf8 | ||
| 5034 | if _obj_0 ~= nil then | ||
| 5035 | return _obj_0.len | ||
| 5036 | end | ||
| 5037 | return nil | ||
| 5038 | end)() or (function() | ||
| 5039 | local _obj_0 = string | ||
| 5040 | if _obj_0 ~= nil then | ||
| 5041 | return _obj_0.len | ||
| 5042 | end | ||
| 5043 | return nil | ||
| 5044 | end)() or function(o) | ||
| 5045 | return #o | ||
| 5046 | end | ||
| 5047 | if print and (x ~= nil) then | ||
| 5048 | print(x) | ||
| 5049 | end | ||
| 5050 | local _with_0 = io.open("test.txt", "w") | ||
| 5051 | if _with_0 ~= nil then | ||
| 5052 | _with_0:write("你好") | ||
| 5053 | _with_0:close() | ||
| 5054 | end | ||
| 5055 | print("你好") | ||
| 5056 | print(1, 2) | ||
| 5057 | print(1, 2, 3) | ||
| 5058 | print(render(emit(parse(extract(readFile("example.txt"), language, { }), language)))) | ||
| 5059 | local a, b, c, d | ||
| 5060 | if b ~= nil then | ||
| 5061 | a = b | ||
| 5062 | else | ||
| 5063 | if c ~= nil then | ||
| 5064 | a = c | ||
| 5065 | else | ||
| 5066 | a = d | ||
| 5067 | end | ||
| 5068 | end | ||
| 5069 | func((function() | ||
| 5070 | if a ~= nil then | ||
| 5071 | return a | ||
| 5072 | else | ||
| 5073 | return { } | ||
| 5074 | end | ||
| 5075 | end)()) | ||
| 5076 | if a == nil then | ||
| 5077 | a = false | ||
| 5078 | end | ||
| 5079 | local list = { | ||
| 5080 | 1, | ||
| 5081 | 2, | ||
| 5082 | 3 | ||
| 5083 | } | ||
| 5084 | func({ | ||
| 5085 | 1, | ||
| 5086 | 2, | ||
| 5087 | 3 | ||
| 5088 | }) | ||
| 5089 | local f | ||
| 5090 | f = function() | ||
| 5091 | return { | ||
| 5092 | 1, | ||
| 5093 | 2, | ||
| 5094 | 3 | ||
| 5095 | } | ||
| 5096 | end | ||
| 5097 | local tb = { | ||
| 5098 | name = "abc", | ||
| 5099 | values = { | ||
| 5100 | "a", | ||
| 5101 | "b", | ||
| 5102 | "c" | ||
| 5103 | }, | ||
| 5104 | objects = { | ||
| 5105 | { | ||
| 5106 | name = "a", | ||
| 5107 | value = 1, | ||
| 5108 | func = function(self) | ||
| 5109 | return self.value + 1 | ||
| 5110 | end, | ||
| 5111 | tb = { | ||
| 5112 | fieldA = 1 | ||
| 5113 | } | ||
| 5114 | }, | ||
| 5115 | { | ||
| 5116 | name = "b", | ||
| 5117 | value = 2, | ||
| 5118 | func = function(self) | ||
| 5119 | return self.value + 2 | ||
| 5120 | end, | ||
| 5121 | tb = { } | ||
| 5122 | } | ||
| 5123 | } | ||
| 5124 | } | ||
| 5125 | local some_string = "这是一个字符串\n 并包括一个换行。" | ||
| 5126 | print("我有" .. tostring(math.random() * 100) .. "%的把握。") | ||
| 5127 | local integer = 1000000 | ||
| 5128 | local hex = 0xEFBBBF | ||
| 5129 | local binary = 19 | ||
| 5130 | local str = "key: value\nlist:\n - item1\n - " .. tostring(expr) | ||
| 5131 | local fn | ||
| 5132 | fn = function() | ||
| 5133 | local str = "foo:\n bar: baz" | ||
| 5134 | return str | ||
| 5135 | end | ||
| 5136 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | ||
| 5137 | local some_string = "这是一个字符串\n 并包括一个换行。" | ||
| 5138 | print("我有" .. tostring(math.random() * 100) .. "%的把握。") | ||
| 5139 | local integer = 1000000 | ||
| 5140 | local hex = 0xEFBBBF | ||
| 5141 | local binary = 19 | ||
| 5142 | local str = "key: value\nlist:\n - item1\n - " .. tostring(expr) | ||
| 5143 | local fn | ||
| 5144 | fn = function() | ||
| 5145 | local str = "foo:\n bar: baz" | ||
| 5146 | return str | ||
| 5147 | end | ||
| 5148 | local str = "path: \"C:\\Program Files\\App\"\nnote: 'He said: \"" .. tostring(Hello) .. "!\"'" | ||
