torture.luau 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. --!strict
  2. -- header comment for torture.luau
  3. local core = require("app.core")
  4. local Signal = require(script.Parent.Signal)
  5. -- doc for Point
  6. type Point = { x: number, y: number }
  7. --- doc for exported Handler
  8. export type Handler = (msg: string) -> ()
  9. export type Generic<T> = { value: T }
  10. type FromTypeof = typeof(require(script.Parent.Config))
  11. --- doc for typedTop
  12. function typedTop(a: number, b: string?): boolean
  13. return a > 0 and b ~= nil
  14. end
  15. function genericFn<T>(v: T): T
  16. return v
  17. end
  18. function multiRet(): (number, string)
  19. return 1, "x"
  20. end
  21. local function emptyOneLiner() end
  22. local M = {}
  23. local CONST_N = 7
  24. function M.make(n: number): Point
  25. return { x = n, y = n }
  26. end
  27. function M:update(p: Point, cb: Handler)
  28. type BodyLocal = { z: number }
  29. local Config = require(script.Parent.Config)
  30. local msg = `point {p.x} of {Config.total()}`
  31. cb(msg)
  32. self:redraw()
  33. self.canvas.flush()
  34. M.make(3)
  35. local v = if p.x > 0 then bump() else drop()
  36. v += grow()
  37. local narrowed = p :: any
  38. for i = 1, 10 do
  39. if i % 2 == 0 then
  40. continue
  41. end
  42. end
  43. end
  44. M.registry = { on_make = M.make, plain = typedTop }
  45. typedTop(1, "s")
  46. M.make(2)
  47. M:update({ x = 1, y = 2 }, print)
  48. local préfixe = "café"
  49. function after_unicode() end
  50. return M