lycheedev 3.2.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1248) hide show
  1. package/README.md +35 -18
  2. package/bin/lycheedev.mjs +3 -38
  3. package/native/windows-amd64/lycheedev.exe +0 -0
  4. package/package.json +1 -1
  5. package/payload/addon/Bridge/CaptureWriter.lua +11 -1
  6. package/payload/addon/Bridge/FocusBindings.lua +31 -24
  7. package/payload/addon/Bridge/InputProtection.lua +7 -4
  8. package/payload/addon/Bridge/InputState.lua +9 -3
  9. package/payload/addon/Bridge/MemoryProtocol.lua +1 -1
  10. package/payload/addon/Bridge/ProbeExecution.lua +12 -6
  11. package/payload/addon/Bridge/ReceiverBindings.lua +1 -0
  12. package/payload/addon/Bridge/SlotProtocol.lua +183 -202
  13. package/payload/addon/Bridge/SlotRuntime.lua +70 -41
  14. package/payload/addon/Core/Controls.lua +1 -1
  15. package/payload/addon/Core/Execute.lua +8 -7
  16. package/payload/addon/Core/Inspector.lua +21 -16
  17. package/payload/addon/Core/Locale.lua +3 -1
  18. package/payload/addon/Core/Locale_enUS.lua +3 -1
  19. package/payload/addon/Core/Runtime.lua +1 -1
  20. package/payload/addon/Core/Safety.lua +20 -6
  21. package/payload/addon/Core/Serializer.lua +55 -39
  22. package/payload/addon/Core/Stores.lua +14 -4
  23. package/payload/addon/Lychee Dev.toc +1 -1
  24. package/payload/addon/Modules/AutomationHistory.lua +3 -3
  25. package/payload/addon/Modules/Events/Catalog.lua +1 -1
  26. package/payload/addon/Modules/Events/Monitor.lua +7 -11
  27. package/payload/addon/Modules/FunctionTrace.lua +4 -0
  28. package/payload/addon/Modules/ObjectInspector.lua +2 -2
  29. package/payload/addon/UI/Pages/Automation.lua +1 -0
  30. package/payload/skill/SKILL.md +114 -39
  31. package/release.json +12 -6381
  32. package/bin/update.mjs +0 -166
  33. package/payload/addon/LICENSE +0 -21
  34. package/payload/addon/THIRD_PARTY_NOTICES +0 -4861
  35. package/payload/skill/agents/openai.yaml +0 -7
  36. package/payload/skill/references/data-investigation.md +0 -52
  37. package/payload/skill/references/live-probes.md +0 -84
  38. package/payload/skill/references/publish.md +0 -30
  39. package/payload/skill/references/runtime-investigations.md +0 -44
  40. package/payload/skill/references/source-research.md +0 -52
  41. package/payload/skill/scripts/lycheedev.mjs +0 -73
  42. package/payload/tool/luals/LICENSE +0 -21
  43. package/payload/tool/luals/bin/concrt140.dll +0 -0
  44. package/payload/tool/luals/bin/lua-language-server.exe +0 -0
  45. package/payload/tool/luals/bin/main.lua +0 -85
  46. package/payload/tool/luals/bin/msvcp140.dll +0 -0
  47. package/payload/tool/luals/bin/msvcp140_1.dll +0 -0
  48. package/payload/tool/luals/bin/msvcp140_2.dll +0 -0
  49. package/payload/tool/luals/bin/msvcp140_atomic_wait.dll +0 -0
  50. package/payload/tool/luals/bin/msvcp140_codecvt_ids.dll +0 -0
  51. package/payload/tool/luals/bin/vcruntime140.dll +0 -0
  52. package/payload/tool/luals/bin/vcruntime140_1.dll +0 -0
  53. package/payload/tool/luals/bin/vcruntime140_threads.dll +0 -0
  54. package/payload/tool/luals/changelog.md +0 -2413
  55. package/payload/tool/luals/debugger.lua +0 -66
  56. package/payload/tool/luals/locale/en-us/meta.lua +0 -885
  57. package/payload/tool/luals/locale/en-us/script.lua +0 -1346
  58. package/payload/tool/luals/locale/en-us/setting.lua +0 -621
  59. package/payload/tool/luals/locale/es-419/meta.lua +0 -884
  60. package/payload/tool/luals/locale/es-419/script.lua +0 -1349
  61. package/payload/tool/luals/locale/es-419/setting.lua +0 -625
  62. package/payload/tool/luals/locale/ja-jp/meta.lua +0 -880
  63. package/payload/tool/luals/locale/ja-jp/script.lua +0 -1341
  64. package/payload/tool/luals/locale/ja-jp/setting.lua +0 -620
  65. package/payload/tool/luals/locale/pt-br/meta.lua +0 -885
  66. package/payload/tool/luals/locale/pt-br/script.lua +0 -1343
  67. package/payload/tool/luals/locale/pt-br/setting.lua +0 -620
  68. package/payload/tool/luals/locale/zh-cn/meta.lua +0 -864
  69. package/payload/tool/luals/locale/zh-cn/script.lua +0 -1337
  70. package/payload/tool/luals/locale/zh-cn/setting.lua +0 -619
  71. package/payload/tool/luals/locale/zh-tw/meta.lua +0 -868
  72. package/payload/tool/luals/locale/zh-tw/script.lua +0 -1333
  73. package/payload/tool/luals/locale/zh-tw/setting.lua +0 -619
  74. package/payload/tool/luals/main.lua +0 -85
  75. package/payload/tool/luals/meta/3rd/Cocos4.0/config.json +0 -7
  76. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Action.lua +0 -81
  77. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionCamera.lua +0 -44
  78. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionEase.lua +0 -26
  79. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionFloat.lua +0 -43
  80. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionInstant.lua +0 -27
  81. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionInterval.lua +0 -40
  82. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionManager.lua +0 -121
  83. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ActionTween.lua +0 -44
  84. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AmbientLight.lua +0 -18
  85. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Animate.lua +0 -49
  86. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Animate3D.lua +0 -106
  87. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Animation.lua +0 -107
  88. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Animation3D.lua +0 -26
  89. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AnimationCache.lua +0 -58
  90. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AnimationFrame.lua +0 -55
  91. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Application.lua +0 -35
  92. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AssetsManager.lua +0 -66
  93. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AssetsManagerEx.lua +0 -60
  94. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AsyncTaskPool.lua +0 -28
  95. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AtlasNode.lua +0 -95
  96. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AttachNode.lua +0 -29
  97. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AudioEngine.lua +0 -148
  98. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AudioProfile.lua +0 -10
  99. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/AutoPolygon.lua +0 -13
  100. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/BaseLight.lua +0 -31
  101. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/BezierBy.lua +0 -29
  102. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/BezierTo.lua +0 -24
  103. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/BillBoard.lua +0 -38
  104. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Blink.lua +0 -40
  105. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Bundle3D.lua +0 -56
  106. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CSLoader.lua +0 -65
  107. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CallFunc.lua +0 -22
  108. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Camera.lua +0 -163
  109. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CameraBackgroundBrush.lua +0 -64
  110. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CameraBackgroundColorBrush.lua +0 -33
  111. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CameraBackgroundDepthBrush.lua +0 -31
  112. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CameraBackgroundSkyBoxBrush.lua +0 -49
  113. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CardinalSplineBy.lua +0 -23
  114. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CardinalSplineTo.lua +0 -42
  115. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CatmullRomBy.lua +0 -19
  116. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/CatmullRomTo.lua +0 -19
  117. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ClippingNode.lua +0 -74
  118. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ClippingRectangleNode.lua +0 -35
  119. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Component.lua +0 -43
  120. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ComponentLua.lua +0 -21
  121. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Console.lua +0 -37
  122. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Control.lua +0 -91
  123. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlButton.lua +0 -260
  124. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlColourPicker.lua +0 -55
  125. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlHuePicker.lua +0 -64
  126. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlPotentiometer.lua +0 -119
  127. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlSaturationBrightnessPicker.lua +0 -44
  128. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlSlider.lua +0 -106
  129. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlStepper.lua +0 -108
  130. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ControlSwitch.lua +0 -70
  131. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Controller.lua +0 -53
  132. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/DelayTime.lua +0 -25
  133. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Device.lua +0 -31
  134. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/DirectionLight.lua +0 -31
  135. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Director.lua +0 -306
  136. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/DrawNode.lua +0 -182
  137. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBackIn.lua +0 -23
  138. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBackInOut.lua +0 -23
  139. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBackOut.lua +0 -23
  140. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBezierAction.lua +0 -32
  141. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBounce.lua +0 -5
  142. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBounceIn.lua +0 -23
  143. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBounceInOut.lua +0 -23
  144. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseBounceOut.lua +0 -23
  145. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseCircleActionIn.lua +0 -23
  146. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseCircleActionInOut.lua +0 -23
  147. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseCircleActionOut.lua +0 -23
  148. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseCubicActionIn.lua +0 -23
  149. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseCubicActionInOut.lua +0 -23
  150. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseCubicActionOut.lua +0 -23
  151. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseElastic.lua +0 -23
  152. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseElasticIn.lua +0 -24
  153. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseElasticInOut.lua +0 -24
  154. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseElasticOut.lua +0 -24
  155. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseExponentialIn.lua +0 -23
  156. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseExponentialInOut.lua +0 -23
  157. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseExponentialOut.lua +0 -23
  158. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseIn.lua +0 -24
  159. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseInOut.lua +0 -24
  160. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseOut.lua +0 -24
  161. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuadraticActionIn.lua +0 -23
  162. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuadraticActionInOut.lua +0 -23
  163. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuadraticActionOut.lua +0 -23
  164. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuarticActionIn.lua +0 -23
  165. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuarticActionInOut.lua +0 -23
  166. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuarticActionOut.lua +0 -23
  167. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuinticActionIn.lua +0 -23
  168. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuinticActionInOut.lua +0 -23
  169. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseQuinticActionOut.lua +0 -23
  170. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseRateAction.lua +0 -28
  171. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseSineIn.lua +0 -23
  172. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseSineInOut.lua +0 -23
  173. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EaseSineOut.lua +0 -23
  174. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Event.lua +0 -27
  175. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventAcceleration.lua +0 -5
  176. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventAssetsManagerEx.lua +0 -53
  177. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventController.lua +0 -37
  178. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventCustom.lua +0 -16
  179. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventDispatcher.lua +0 -111
  180. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventFocus.lua +0 -14
  181. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventKeyboard.lua +0 -14
  182. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListener.lua +0 -26
  183. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerAcceleration.lua +0 -19
  184. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerAssetsManagerEx.lua +0 -20
  185. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerController.lua +0 -16
  186. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerCustom.lua +0 -15
  187. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerFocus.lua +0 -18
  188. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerKeyboard.lua +0 -18
  189. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerMouse.lua +0 -18
  190. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerPhysicsContact.lua +0 -16
  191. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerPhysicsContactWithBodies.lua +0 -19
  192. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerPhysicsContactWithGroup.lua +0 -18
  193. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerPhysicsContactWithShapes.lua +0 -19
  194. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerTouchAllAtOnce.lua +0 -18
  195. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventListenerTouchOneByOne.lua +0 -27
  196. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventMouse.lua +0 -88
  197. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/EventTouch.lua +0 -19
  198. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeIn.lua +0 -29
  199. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeOut.lua +0 -28
  200. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeOutBLTiles.lua +0 -25
  201. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeOutDownTiles.lua +0 -25
  202. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeOutTRTiles.lua +0 -49
  203. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeOutUpTiles.lua +0 -30
  204. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FadeTo.lua +0 -37
  205. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FastTMXLayer.lua +0 -132
  206. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FastTMXTiledMap.lua +0 -87
  207. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FileUtils.lua +0 -340
  208. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FiniteTimeAction.lua +0 -21
  209. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FlipX.lua +0 -29
  210. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FlipX3D.lua +0 -36
  211. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FlipY.lua +0 -29
  212. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/FlipY3D.lua +0 -22
  213. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Follow.lua +0 -85
  214. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/GLView.lua +0 -184
  215. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/GLViewImpl.lua +0 -30
  216. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Grid3D.lua +0 -43
  217. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Grid3DAction.lua +0 -16
  218. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/GridAction.lua +0 -28
  219. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/GridBase.lua +0 -86
  220. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Hide.lua +0 -23
  221. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Image.lua +0 -70
  222. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/JumpBy.lua +0 -43
  223. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/JumpTiles3D.lua +0 -58
  224. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/JumpTo.lua +0 -39
  225. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Label.lua +0 -397
  226. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/LabelAtlas.lua +0 -42
  227. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Layer.lua +0 -19
  228. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/LayerColor.lua +0 -67
  229. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/LayerGradient.lua +0 -86
  230. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/LayerMultiplex.lua +0 -37
  231. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/LayerRadialGradient.lua +0 -100
  232. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Lens3D.lua +0 -63
  233. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Liquid.lua +0 -58
  234. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Manifest.lua +0 -27
  235. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Material.lua +0 -88
  236. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Menu.lua +0 -68
  237. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItem.lua +0 -34
  238. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItemAtlasFont.lua +0 -18
  239. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItemFont.lua +0 -54
  240. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItemImage.lua +0 -31
  241. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItemLabel.lua +0 -48
  242. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItemSprite.lua +0 -48
  243. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MenuItemToggle.lua +0 -47
  244. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Mesh.lua +0 -82
  245. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MotionStreak.lua +0 -121
  246. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MotionStreak3D.lua +0 -143
  247. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MoveBy.lua +0 -35
  248. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/MoveTo.lua +0 -31
  249. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/NavMesh.lua +0 -47
  250. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/NavMeshAgent.lua +0 -122
  251. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/NavMeshObstacle.lua +0 -49
  252. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Node.lua +0 -802
  253. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/NodeGrid.lua +0 -43
  254. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/OrbitCamera.lua +0 -48
  255. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PUParticleSystem3D.lua +0 -192
  256. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PageTurn3D.lua +0 -24
  257. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParallaxNode.lua +0 -49
  258. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleBatchNode.lua +0 -116
  259. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleData.lua +0 -24
  260. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleExplosion.lua +0 -27
  261. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleFire.lua +0 -27
  262. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleFireworks.lua +0 -27
  263. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleFlower.lua +0 -27
  264. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleGalaxy.lua +0 -27
  265. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleMeteor.lua +0 -27
  266. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleRain.lua +0 -27
  267. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSmoke.lua +0 -27
  268. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSnow.lua +0 -27
  269. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSpiral.lua +0 -27
  270. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSun.lua +0 -27
  271. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSystem.lua +0 -526
  272. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSystem3D.lua +0 -87
  273. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ParticleSystemQuad.lua +0 -52
  274. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Pass.lua +0 -148
  275. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3D6DofConstraint.lua +0 -58
  276. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DComponent.lua +0 -46
  277. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DConeTwistConstraint.lua +0 -97
  278. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DConstraint.lua +0 -46
  279. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DHingeConstraint.lua +0 -100
  280. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DObject.lua +0 -39
  281. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DPointToPointConstraint.lua +0 -39
  282. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DRigidBody.lua +0 -201
  283. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DShape.lua +0 -64
  284. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DSliderConstraint.lua +0 -245
  285. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Physics3DWorld.lua +0 -63
  286. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsBody.lua +0 -335
  287. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsContact.lua +0 -21
  288. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsContactPostSolve.lua +0 -15
  289. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsContactPreSolve.lua +0 -30
  290. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJoint.lua +0 -48
  291. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointDistance.lua +0 -28
  292. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointFixed.lua +0 -19
  293. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointGear.lua +0 -35
  294. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointGroove.lua +0 -44
  295. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointLimit.lua +0 -47
  296. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointMotor.lua +0 -26
  297. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointPin.lua +0 -17
  298. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointRatchet.lua +0 -42
  299. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointRotaryLimit.lua +0 -31
  300. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointRotarySpring.lua +0 -42
  301. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsJointSpring.lua +0 -60
  302. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShape.lua +0 -155
  303. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapeBox.lua +0 -25
  304. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapeCircle.lua +0 -44
  305. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapeEdgeBox.lua +0 -22
  306. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapeEdgeChain.lua +0 -14
  307. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapeEdgePolygon.lua +0 -14
  308. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapeEdgeSegment.lua +0 -30
  309. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsShapePolygon.lua +0 -24
  310. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsSprite3D.lua +0 -22
  311. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PhysicsWorld.lua +0 -147
  312. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Place.lua +0 -29
  313. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PointLight.lua +0 -29
  314. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/PolygonInfo.lua +0 -60
  315. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ProgressFromTo.lua +0 -43
  316. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ProgressTimer.lua +0 -107
  317. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ProgressTo.lua +0 -39
  318. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Properties.lua +0 -226
  319. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ProtectedNode.lua +0 -96
  320. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Ref.lua +0 -25
  321. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/RemoveSelf.lua +0 -28
  322. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/RenderState.lua +0 -15
  323. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/RenderTexture.lua +0 -166
  324. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Renderer.lua +0 -251
  325. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Repeat.lua +0 -51
  326. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/RepeatForever.lua +0 -45
  327. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ReuseGrid.lua +0 -31
  328. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Ripple3D.lua +0 -75
  329. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/RotateBy.lua +0 -39
  330. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/RotateTo.lua +0 -38
  331. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ScaleBy.lua +0 -28
  332. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ScaleTo.lua +0 -41
  333. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Scene.lua +0 -72
  334. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Scheduler.lua +0 -30
  335. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Sequence.lua +0 -38
  336. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ShaderCache.lua +0 -27
  337. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Shaky3D.lua +0 -40
  338. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ShakyTiles3D.lua +0 -40
  339. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ShatteredTiles3D.lua +0 -40
  340. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Show.lua +0 -23
  341. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ShuffleTiles.lua +0 -44
  342. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Skeleton3D.lua +0 -41
  343. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SkewBy.lua +0 -35
  344. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SkewTo.lua +0 -39
  345. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Skybox.lua +0 -44
  346. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Spawn.lua +0 -35
  347. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Speed.lua +0 -60
  348. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SplitCols.lua +0 -36
  349. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SplitRows.lua +0 -36
  350. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SpotLight.lua +0 -70
  351. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Sprite.lua +0 -337
  352. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Sprite3D.lua +0 -118
  353. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Sprite3DCache.lua +0 -22
  354. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Sprite3DMaterial.lua +0 -35
  355. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SpriteBatchNode.lua +0 -188
  356. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SpriteFrame.lua +0 -153
  357. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/SpriteFrameCache.lua +0 -106
  358. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/StopGrid.lua +0 -23
  359. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TMXLayer.lua +0 -141
  360. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TMXLayerInfo.lua +0 -16
  361. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TMXMapInfo.lua +0 -161
  362. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TMXObjectGroup.lua +0 -58
  363. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TMXTiledMap.lua +0 -106
  364. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TMXTilesetInfo.lua +0 -13
  365. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TableView.lua +0 -81
  366. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TableViewCell.lua +0 -22
  367. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TargetedAction.lua +0 -48
  368. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Technique.lua +0 -41
  369. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Terrain.lua +0 -108
  370. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Texture2D.lua +0 -161
  371. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TextureCache.lua +0 -98
  372. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TextureCube.lua +0 -36
  373. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TileMapAtlas.lua +0 -39
  374. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TiledGrid3D.lua +0 -25
  375. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TiledGrid3DAction.lua +0 -12
  376. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Timer.lua +0 -32
  377. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TintBy.lua +0 -42
  378. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TintTo.lua +0 -38
  379. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/ToggleVisibility.lua +0 -23
  380. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Touch.lua +0 -61
  381. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionCrossFade.lua +0 -23
  382. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionEaseScene.lua +0 -13
  383. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFade.lua +0 -23
  384. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFadeBL.lua +0 -21
  385. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFadeDown.lua +0 -21
  386. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFadeTR.lua +0 -33
  387. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFadeUp.lua +0 -21
  388. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFlipAngular.lua +0 -16
  389. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFlipX.lua +0 -16
  390. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionFlipY.lua +0 -16
  391. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionJumpZoom.lua +0 -17
  392. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionMoveInB.lua +0 -17
  393. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionMoveInL.lua +0 -25
  394. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionMoveInR.lua +0 -17
  395. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionMoveInT.lua +0 -17
  396. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionPageTurn.lua +0 -45
  397. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgress.lua +0 -17
  398. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgressHorizontal.lua +0 -17
  399. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgressInOut.lua +0 -17
  400. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgressOutIn.lua +0 -17
  401. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgressRadialCCW.lua +0 -17
  402. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgressRadialCW.lua +0 -17
  403. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionProgressVertical.lua +0 -17
  404. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionRotoZoom.lua +0 -17
  405. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionScene.lua +0 -43
  406. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSceneOriented.lua +0 -25
  407. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionShrinkGrow.lua +0 -21
  408. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSlideInB.lua +0 -20
  409. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSlideInL.lua +0 -25
  410. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSlideInR.lua +0 -20
  411. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSlideInT.lua +0 -20
  412. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSplitCols.lua +0 -31
  413. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionSplitRows.lua +0 -20
  414. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionTurnOffTiles.lua +0 -27
  415. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionZoomFlipAngular.lua +0 -16
  416. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionZoomFlipX.lua +0 -16
  417. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TransitionZoomFlipY.lua +0 -16
  418. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/TurnOffTiles.lua +0 -47
  419. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Twirl.lua +0 -71
  420. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/UserDefault.lua +0 -98
  421. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Waves.lua +0 -66
  422. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/Waves3D.lua +0 -58
  423. package/payload/tool/luals/meta/3rd/Cocos4.0/library/cc/WavesTiles3D.lua +0 -58
  424. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccb/Program.lua +0 -51
  425. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccb/ProgramState.lua +0 -40
  426. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccb/Texture2DBackend.lua +0 -70
  427. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccb/TextureBackend.lua +0 -48
  428. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccb/TextureCubemapBackend.lua +0 -13
  429. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccb/VertexLayout.lua +0 -39
  430. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionFadeFrame.lua +0 -24
  431. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionFrame.lua +0 -56
  432. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionManagerEx.lua +0 -45
  433. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionMoveFrame.lua +0 -24
  434. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionObject.lua +0 -82
  435. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionRotationFrame.lua +0 -24
  436. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionScaleFrame.lua +0 -33
  437. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionTimeline.lua +0 -162
  438. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionTimelineCache.lua +0 -53
  439. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionTimelineData.lua +0 -24
  440. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionTimelineNode.lua +0 -36
  441. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ActionTintFrame.lua +0 -24
  442. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/AlphaFrame.lua +0 -22
  443. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/AnchorPointFrame.lua +0 -22
  444. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/AnimationData.lua +0 -23
  445. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/Armature.lua +0 -136
  446. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ArmatureAnimation.lua +0 -100
  447. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ArmatureData.lua +0 -23
  448. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ArmatureDataManager.lua +0 -101
  449. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ArmatureDisplayData.lua +0 -12
  450. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/BaseData.lua +0 -19
  451. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/BatchNode.lua +0 -30
  452. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/BlendFuncFrame.lua +0 -22
  453. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/Bone.lua +0 -164
  454. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/BoneData.lua +0 -23
  455. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/BoneNode.lua +0 -129
  456. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ColorFrame.lua +0 -22
  457. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ComAttribute.lua +0 -63
  458. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ComAudio.lua +0 -131
  459. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ComController.lua +0 -30
  460. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ComExtensionData.lua +0 -40
  461. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ComRender.lua +0 -34
  462. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ContourData.lua +0 -19
  463. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/DisplayData.lua +0 -20
  464. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/DisplayManager.lua +0 -89
  465. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/EventFrame.lua +0 -29
  466. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/Frame.lua +0 -58
  467. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/FrameData.lua +0 -16
  468. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/GUIReader.lua +0 -31
  469. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/InnerActionFrame.lua +0 -51
  470. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/MovementBoneData.lua +0 -23
  471. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/MovementData.lua +0 -20
  472. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ParticleDisplayData.lua +0 -12
  473. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/PlayableFrame.lua +0 -22
  474. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/PositionFrame.lua +0 -36
  475. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/RotationFrame.lua +0 -22
  476. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/RotationSkewFrame.lua +0 -15
  477. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ScaleFrame.lua +0 -33
  478. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/SceneReader.lua +0 -32
  479. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/SkeletonNode.lua +0 -37
  480. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/SkewFrame.lua +0 -29
  481. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/Skin.lua +0 -54
  482. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/SpriteDisplayData.lua +0 -16
  483. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/TextureData.lua +0 -23
  484. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/TextureFrame.lua +0 -26
  485. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/Timeline.lua +0 -60
  486. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/Tween.lua +0 -55
  487. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/VisibleFrame.lua +0 -22
  488. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccs/ZOrderFrame.lua +0 -22
  489. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/AbstractCheckButton.lua +0 -146
  490. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Button.lua +0 -223
  491. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/CheckBox.lua +0 -32
  492. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/EditBox.lua +0 -320
  493. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/HBox.lua +0 -23
  494. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Helper.lua +0 -70
  495. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/ImageView.lua +0 -89
  496. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Layout.lua +0 -217
  497. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/LayoutComponent.lua +0 -248
  498. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/LayoutParameter.lua +0 -32
  499. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/LinearLayoutParameter.lua +0 -32
  500. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/ListView.lua +0 -302
  501. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/LoadingBar.lua +0 -84
  502. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/PageView.lua +0 -177
  503. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RadioButton.lua +0 -32
  504. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RadioButtonGroup.lua +0 -70
  505. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RelativeBox.lua +0 -23
  506. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RelativeLayoutParameter.lua +0 -50
  507. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RichElement.lua +0 -29
  508. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RichElementCustomNode.lua +0 -35
  509. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RichElementImage.lua +0 -55
  510. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RichElementNewLine.lua +0 -21
  511. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RichElementText.lua +0 -107
  512. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/RichText.lua +0 -208
  513. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Scale9Sprite.lua +0 -222
  514. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/ScrollView.lua +0 -375
  515. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Slider.lua +0 -188
  516. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/TabControl.lua +0 -101
  517. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/TabHeader.lua +0 -71
  518. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Text.lua +0 -203
  519. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/TextAtlas.lua +0 -65
  520. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/TextBMFont.lua +0 -52
  521. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/TextField.lua +0 -245
  522. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/VBox.lua +0 -23
  523. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/VideoPlayer.lua +0 -111
  524. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/WebView.lua +0 -90
  525. package/payload/tool/luals/meta/3rd/Cocos4.0/library/ccui/Widget.lua +0 -396
  526. package/payload/tool/luals/meta/3rd/Cocos4.0/library/global.lua +0 -215
  527. package/payload/tool/luals/meta/3rd/Cocos4.0/library/sp/SkeletonAnimation.lua +0 -111
  528. package/payload/tool/luals/meta/3rd/Cocos4.0/library/sp/SkeletonRenderer.lua +0 -126
  529. package/payload/tool/luals/meta/3rd/Defold/config.json +0 -22
  530. package/payload/tool/luals/meta/3rd/Defold/library/base.lua +0 -83
  531. package/payload/tool/luals/meta/3rd/Defold/library/buffer.lua +0 -68
  532. package/payload/tool/luals/meta/3rd/Defold/library/built-ins.lua +0 -24
  533. package/payload/tool/luals/meta/3rd/Defold/library/collection_factory.lua +0 -54
  534. package/payload/tool/luals/meta/3rd/Defold/library/collection_proxy.lua +0 -9
  535. package/payload/tool/luals/meta/3rd/Defold/library/collision_object.lua +0 -149
  536. package/payload/tool/luals/meta/3rd/Defold/library/factory.lua +0 -47
  537. package/payload/tool/luals/meta/3rd/Defold/library/game_object.lua +0 -340
  538. package/payload/tool/luals/meta/3rd/Defold/library/gui.lua +0 -929
  539. package/payload/tool/luals/meta/3rd/Defold/library/html5.lua +0 -23
  540. package/payload/tool/luals/meta/3rd/Defold/library/http.lua +0 -18
  541. package/payload/tool/luals/meta/3rd/Defold/library/image.lua +0 -20
  542. package/payload/tool/luals/meta/3rd/Defold/library/json.lua +0 -20
  543. package/payload/tool/luals/meta/3rd/Defold/library/label.lua +0 -20
  544. package/payload/tool/luals/meta/3rd/Defold/library/luasocket.lua +0 -484
  545. package/payload/tool/luals/meta/3rd/Defold/library/message.lua +0 -56
  546. package/payload/tool/luals/meta/3rd/Defold/library/model.lua +0 -43
  547. package/payload/tool/luals/meta/3rd/Defold/library/particle_effects.lua +0 -52
  548. package/payload/tool/luals/meta/3rd/Defold/library/profiler.lua +0 -89
  549. package/payload/tool/luals/meta/3rd/Defold/library/render.lua +0 -439
  550. package/payload/tool/luals/meta/3rd/Defold/library/resource.lua +0 -181
  551. package/payload/tool/luals/meta/3rd/Defold/library/sound.lua +0 -126
  552. package/payload/tool/luals/meta/3rd/Defold/library/sprite.lua +0 -32
  553. package/payload/tool/luals/meta/3rd/Defold/library/system.lua +0 -161
  554. package/payload/tool/luals/meta/3rd/Defold/library/tilemap.lua +0 -78
  555. package/payload/tool/luals/meta/3rd/Defold/library/timer.lua +0 -36
  556. package/payload/tool/luals/meta/3rd/Defold/library/vector_math.lua +0 -406
  557. package/payload/tool/luals/meta/3rd/Defold/library/window.lua +0 -56
  558. package/payload/tool/luals/meta/3rd/Defold/library/zlib.lua +0 -18
  559. package/payload/tool/luals/meta/3rd/Jass/config.json +0 -6
  560. package/payload/tool/luals/meta/3rd/Jass/library/jass/common.lua +0 -12329
  561. package/payload/tool/luals/meta/3rd/OpenResty/config.json +0 -19
  562. package/payload/tool/luals/meta/3rd/OpenResty/library/cjson/safe.lua +0 -42
  563. package/payload/tool/luals/meta/3rd/OpenResty/library/cjson.lua +0 -470
  564. package/payload/tool/luals/meta/3rd/OpenResty/library/jit.lua +0 -31
  565. package/payload/tool/luals/meta/3rd/OpenResty/library/ndk.lua +0 -4
  566. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/balancer.lua +0 -117
  567. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/base64.lua +0 -21
  568. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/errlog.lua +0 -119
  569. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/ocsp.lua +0 -60
  570. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/pipe.lua +0 -307
  571. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/process.lua +0 -48
  572. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/re.lua +0 -102
  573. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/req.lua +0 -16
  574. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/resp.lua +0 -23
  575. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/semaphore.lua +0 -62
  576. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/ssl/clienthello.lua +0 -99
  577. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/ssl/session.lua +0 -51
  578. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/ssl.lua +0 -276
  579. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx/upstream.lua +0 -9
  580. package/payload/tool/luals/meta/3rd/OpenResty/library/ngx.lua +0 -4351
  581. package/payload/tool/luals/meta/3rd/OpenResty/library/prometheus.lua +0 -247
  582. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/aes.lua +0 -74
  583. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/base.lua +0 -51
  584. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/base64.lua +0 -4
  585. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/ctx.lua +0 -9
  586. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/exit.lua +0 -4
  587. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/hash.lua +0 -4
  588. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/misc.lua +0 -6
  589. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/ndk.lua +0 -4
  590. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/phase.lua +0 -4
  591. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/regex.lua +0 -55
  592. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/request.lua +0 -5
  593. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/response.lua +0 -5
  594. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/shdict.lua +0 -4
  595. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/time.lua +0 -4
  596. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/uri.lua +0 -4
  597. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/utils.lua +0 -10
  598. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/var.lua +0 -4
  599. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core/worker.lua +0 -4
  600. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/core.lua +0 -4
  601. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/dns/resolver.lua +0 -395
  602. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/limit/conn.lua +0 -11
  603. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/limit/count.lua +0 -7
  604. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/limit/req.lua +0 -9
  605. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/limit/traffic.lua +0 -5
  606. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/lock.lua +0 -125
  607. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/lrucache/pureffi.lua +0 -18
  608. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/lrucache.lua +0 -107
  609. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/md5.lua +0 -16
  610. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/memcached.lua +0 -27
  611. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/mysql.lua +0 -15
  612. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/random.lua +0 -10
  613. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/redis.lua +0 -57
  614. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/sha.lua +0 -4
  615. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/sha1.lua +0 -10
  616. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/sha224.lua +0 -10
  617. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/sha256.lua +0 -10
  618. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/sha384.lua +0 -10
  619. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/sha512.lua +0 -10
  620. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/shell.lua +0 -60
  621. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/signal.lua +0 -69
  622. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/string.lua +0 -72
  623. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/upload.lua +0 -7
  624. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/upstream/healthcheck.lua +0 -6
  625. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/websocket/client.lua +0 -62
  626. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/websocket/protocol.lua +0 -172
  627. package/payload/tool/luals/meta/3rd/OpenResty/library/resty/websocket/server.lua +0 -16
  628. package/payload/tool/luals/meta/3rd/OpenResty/library/table/clone.lua +0 -25
  629. package/payload/tool/luals/meta/3rd/OpenResty/library/table/isarray.lua +0 -23
  630. package/payload/tool/luals/meta/3rd/OpenResty/library/table/isempty.lua +0 -22
  631. package/payload/tool/luals/meta/3rd/OpenResty/library/table/nkeys.lua +0 -23
  632. package/payload/tool/luals/meta/3rd/OpenResty/library/tablepool.lua +0 -29
  633. package/payload/tool/luals/meta/3rd/OpenResty/library/thread/exdata.lua +0 -43
  634. package/payload/tool/luals/meta/3rd/OpenResty/library/thread/exdata2.lua +0 -8
  635. package/payload/tool/luals/meta/3rd/bee/LICENSE +0 -21
  636. package/payload/tool/luals/meta/3rd/bee/config.json +0 -5
  637. package/payload/tool/luals/meta/3rd/bee/library/bee/channel.lua +0 -24
  638. package/payload/tool/luals/meta/3rd/bee/library/bee/epoll.lua +0 -58
  639. package/payload/tool/luals/meta/3rd/bee/library/bee/filesystem.lua +0 -189
  640. package/payload/tool/luals/meta/3rd/bee/library/bee/platform.lua +0 -62
  641. package/payload/tool/luals/meta/3rd/bee/library/bee/select.lua +0 -34
  642. package/payload/tool/luals/meta/3rd/bee/library/bee/serialization.lua +0 -14
  643. package/payload/tool/luals/meta/3rd/bee/library/bee/socket.lua +0 -102
  644. package/payload/tool/luals/meta/3rd/bee/library/bee/subprocess.lua +0 -82
  645. package/payload/tool/luals/meta/3rd/bee/library/bee/sys.lua +0 -12
  646. package/payload/tool/luals/meta/3rd/bee/library/bee/thread.lua +0 -48
  647. package/payload/tool/luals/meta/3rd/bee/library/bee/time.lua +0 -10
  648. package/payload/tool/luals/meta/3rd/busted/config.json +0 -7
  649. package/payload/tool/luals/meta/3rd/busted/library/busted.lua +0 -298
  650. package/payload/tool/luals/meta/3rd/example/config.json +0 -22
  651. package/payload/tool/luals/meta/3rd/example/library/love.lua +0 -8
  652. package/payload/tool/luals/meta/3rd/example/plugin.lua +0 -16
  653. package/payload/tool/luals/meta/3rd/ffi-reflect/config.json +0 -3
  654. package/payload/tool/luals/meta/3rd/ffi-reflect/library/reflect.lua +0 -128
  655. package/payload/tool/luals/meta/3rd/lfs/config.json +0 -9
  656. package/payload/tool/luals/meta/3rd/lfs/library/lfs.lua +0 -145
  657. package/payload/tool/luals/meta/3rd/love2d/config.json +0 -10
  658. package/payload/tool/luals/meta/3rd/love2d/library/love/audio.lua +0 -980
  659. package/payload/tool/luals/meta/3rd/love2d/library/love/data.lua +0 -264
  660. package/payload/tool/luals/meta/3rd/love2d/library/love/event.lua +0 -244
  661. package/payload/tool/luals/meta/3rd/love2d/library/love/filesystem.lua +0 -653
  662. package/payload/tool/luals/meta/3rd/love2d/library/love/font.lua +0 -281
  663. package/payload/tool/luals/meta/3rd/love2d/library/love/graphics.lua +0 -3977
  664. package/payload/tool/luals/meta/3rd/love2d/library/love/image.lua +0 -695
  665. package/payload/tool/luals/meta/3rd/love2d/library/love/joystick.lua +0 -464
  666. package/payload/tool/luals/meta/3rd/love2d/library/love/keyboard.lua +0 -1484
  667. package/payload/tool/luals/meta/3rd/love2d/library/love/math.lua +0 -704
  668. package/payload/tool/luals/meta/3rd/love2d/library/love/mouse.lua +0 -283
  669. package/payload/tool/luals/meta/3rd/love2d/library/love/physics.lua +0 -3281
  670. package/payload/tool/luals/meta/3rd/love2d/library/love/sound.lua +0 -189
  671. package/payload/tool/luals/meta/3rd/love2d/library/love/system.lua +0 -115
  672. package/payload/tool/luals/meta/3rd/love2d/library/love/thread.lua +0 -210
  673. package/payload/tool/luals/meta/3rd/love2d/library/love/timer.lua +0 -68
  674. package/payload/tool/luals/meta/3rd/love2d/library/love/touch.lua +0 -40
  675. package/payload/tool/luals/meta/3rd/love2d/library/love/video.lua +0 -92
  676. package/payload/tool/luals/meta/3rd/love2d/library/love/window.lua +0 -473
  677. package/payload/tool/luals/meta/3rd/love2d/library/love.lua +0 -334
  678. package/payload/tool/luals/meta/3rd/lovr/config.json +0 -7
  679. package/payload/tool/luals/meta/3rd/lovr/library/callback.lua +0 -230
  680. package/payload/tool/luals/meta/3rd/lovr/library/lovr/audio.lua +0 -844
  681. package/payload/tool/luals/meta/3rd/lovr/library/lovr/data.lua +0 -1557
  682. package/payload/tool/luals/meta/3rd/lovr/library/lovr/event.lua +0 -430
  683. package/payload/tool/luals/meta/3rd/lovr/library/lovr/filesystem.lua +0 -317
  684. package/payload/tool/luals/meta/3rd/lovr/library/lovr/graphics.lua +0 -3541
  685. package/payload/tool/luals/meta/3rd/lovr/library/lovr/headset.lua +0 -791
  686. package/payload/tool/luals/meta/3rd/lovr/library/lovr/math.lua +0 -1233
  687. package/payload/tool/luals/meta/3rd/lovr/library/lovr/physics.lua +0 -1779
  688. package/payload/tool/luals/meta/3rd/lovr/library/lovr/system.lua +0 -110
  689. package/payload/tool/luals/meta/3rd/lovr/library/lovr/thread.lua +0 -170
  690. package/payload/tool/luals/meta/3rd/lovr/library/lovr/timer.lua +0 -59
  691. package/payload/tool/luals/meta/3rd/lovr/library/lovr.lua +0 -42
  692. package/payload/tool/luals/meta/3rd/luaecs/config.json +0 -4
  693. package/payload/tool/luals/meta/3rd/luaecs/library/ecs.lua +0 -355
  694. package/payload/tool/luals/meta/3rd/luassert/config.json +0 -3
  695. package/payload/tool/luals/meta/3rd/luassert/library/luassert/array.lua +0 -15
  696. package/payload/tool/luals/meta/3rd/luassert/library/luassert/match.lua +0 -413
  697. package/payload/tool/luals/meta/3rd/luassert/library/luassert/mock.lua +0 -28
  698. package/payload/tool/luals/meta/3rd/luassert/library/luassert/spy.d.lua +0 -100
  699. package/payload/tool/luals/meta/3rd/luassert/library/luassert/spy.lua +0 -81
  700. package/payload/tool/luals/meta/3rd/luassert/library/luassert/stub.lua +0 -50
  701. package/payload/tool/luals/meta/3rd/luassert/library/luassert.lua +0 -441
  702. package/payload/tool/luals/meta/3rd/luv/config.json +0 -8
  703. package/payload/tool/luals/meta/3rd/luv/library/errors.lua +0 -261
  704. package/payload/tool/luals/meta/3rd/luv/library/luv_dir_t.lua +0 -34
  705. package/payload/tool/luals/meta/3rd/luv/library/luv_thread_t.lua +0 -20
  706. package/payload/tool/luals/meta/3rd/luv/library/luv_work_ctx_t.lua +0 -17
  707. package/payload/tool/luals/meta/3rd/luv/library/types.lua +0 -526
  708. package/payload/tool/luals/meta/3rd/luv/library/uv.lua +0 -3075
  709. package/payload/tool/luals/meta/3rd/luv/library/uv_async_t.lua +0 -35
  710. package/payload/tool/luals/meta/3rd/luv/library/uv_check_t.lua +0 -29
  711. package/payload/tool/luals/meta/3rd/luv/library/uv_fs_event_t.lua +0 -33
  712. package/payload/tool/luals/meta/3rd/luv/library/uv_fs_poll_t.lua +0 -35
  713. package/payload/tool/luals/meta/3rd/luv/library/uv_handle_t.lua +0 -132
  714. package/payload/tool/luals/meta/3rd/luv/library/uv_idle_t.lua +0 -38
  715. package/payload/tool/luals/meta/3rd/luv/library/uv_pipe_t.lua +0 -103
  716. package/payload/tool/luals/meta/3rd/luv/library/uv_poll_t.lua +0 -57
  717. package/payload/tool/luals/meta/3rd/luv/library/uv_prepare_t.lua +0 -30
  718. package/payload/tool/luals/meta/3rd/luv/library/uv_process_t.lua +0 -22
  719. package/payload/tool/luals/meta/3rd/luv/library/uv_req_t.lua +0 -25
  720. package/payload/tool/luals/meta/3rd/luv/library/uv_signal_t.lua +0 -69
  721. package/payload/tool/luals/meta/3rd/luv/library/uv_stream_t.lua +0 -173
  722. package/payload/tool/luals/meta/3rd/luv/library/uv_tcp_t.lua +0 -112
  723. package/payload/tool/luals/meta/3rd/luv/library/uv_timer_t.lua +0 -55
  724. package/payload/tool/luals/meta/3rd/luv/library/uv_tty_t.lua +0 -44
  725. package/payload/tool/luals/meta/3rd/luv/library/uv_udp_t.lua +0 -175
  726. package/payload/tool/luals/meta/3rd/skynet/config.json +0 -4
  727. package/payload/tool/luals/meta/3rd/skynet/library/skynet/cluster.lua +0 -44
  728. package/payload/tool/luals/meta/3rd/skynet/library/skynet/crypt.lua +0 -74
  729. package/payload/tool/luals/meta/3rd/skynet/library/skynet/db/mongo.lua +0 -176
  730. package/payload/tool/luals/meta/3rd/skynet/library/skynet/db/mysql.lua +0 -43
  731. package/payload/tool/luals/meta/3rd/skynet/library/skynet/db/redis.lua +0 -70
  732. package/payload/tool/luals/meta/3rd/skynet/library/skynet/debug.lua +0 -13
  733. package/payload/tool/luals/meta/3rd/skynet/library/skynet/habor.lua +0 -22
  734. package/payload/tool/luals/meta/3rd/skynet/library/skynet/muliticast.lua +0 -23
  735. package/payload/tool/luals/meta/3rd/skynet/library/skynet/netpack.lua +0 -38
  736. package/payload/tool/luals/meta/3rd/skynet/library/skynet/profile.lua +0 -19
  737. package/payload/tool/luals/meta/3rd/skynet/library/skynet/sharedata.lua +0 -33
  738. package/payload/tool/luals/meta/3rd/skynet/library/skynet/sharemap.lua +0 -46
  739. package/payload/tool/luals/meta/3rd/skynet/library/skynet/sharetable.lua +0 -32
  740. package/payload/tool/luals/meta/3rd/skynet/library/skynet/socket.lua +0 -117
  741. package/payload/tool/luals/meta/3rd/skynet/library/skynet/socketchannel.lua +0 -58
  742. package/payload/tool/luals/meta/3rd/skynet/library/skynet/socketdriver.lua +0 -132
  743. package/payload/tool/luals/meta/3rd/skynet/library/skynet/stm.lua +0 -32
  744. package/payload/tool/luals/meta/3rd/skynet/library/skynet.lua +0 -479
  745. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/basic.lua +0 -467
  746. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/bit.lua +0 -76
  747. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/bit32.lua +0 -156
  748. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/builtin.lua +0 -16
  749. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/coroutine.lua +0 -96
  750. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/debug.lua +0 -268
  751. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/ffi.lua +0 -121
  752. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/io.lua +0 -265
  753. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/jit/profile.lua +0 -19
  754. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/jit/util.lua +0 -119
  755. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/jit.lua +0 -42
  756. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/math.lua +0 -381
  757. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/os.lua +0 -244
  758. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/package.lua +0 -107
  759. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/string/buffer.lua +0 -353
  760. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/string.lua +0 -219
  761. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/table/clear.lua +0 -17
  762. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/table/new.lua +0 -19
  763. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/table.lua +0 -177
  764. package/payload/tool/luals/meta/Lua 5.4 zh-cn utf8/utf8.lua +0 -87
  765. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/basic.lua +0 -453
  766. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/bit.lua +0 -76
  767. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/bit32.lua +0 -156
  768. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/builtin.lua +0 -16
  769. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/coroutine.lua +0 -96
  770. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/debug.lua +0 -262
  771. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/ffi.lua +0 -121
  772. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/io.lua +0 -265
  773. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/jit/profile.lua +0 -19
  774. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/jit/util.lua +0 -119
  775. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/jit.lua +0 -42
  776. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/math.lua +0 -364
  777. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/os.lua +0 -244
  778. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/package.lua +0 -106
  779. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/string/buffer.lua +0 -353
  780. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/string.lua +0 -219
  781. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/table/clear.lua +0 -17
  782. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/table/new.lua +0 -19
  783. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/table.lua +0 -177
  784. package/payload/tool/luals/meta/LuaJIT zh-cn utf8/utf8.lua +0 -84
  785. package/payload/tool/luals/meta/default utf8/CS.lua +0 -14408
  786. package/payload/tool/luals/meta/default utf8/System.CodeDom.Compiler.lua +0 -822
  787. package/payload/tool/luals/meta/default utf8/System.CodeDom.lua +0 -1452
  788. package/payload/tool/luals/meta/default utf8/System.Collections.Concurrent.lua +0 -541
  789. package/payload/tool/luals/meta/default utf8/System.Collections.Generic.lua +0 -1397
  790. package/payload/tool/luals/meta/default utf8/System.Collections.ObjectModel.lua +0 -189
  791. package/payload/tool/luals/meta/default utf8/System.Collections.Specialized.lua +0 -607
  792. package/payload/tool/luals/meta/default utf8/System.Collections.lua +0 -915
  793. package/payload/tool/luals/meta/default utf8/System.ComponentModel.Design.Serialization.lua +0 -427
  794. package/payload/tool/luals/meta/default utf8/System.ComponentModel.Design.lua +0 -1582
  795. package/payload/tool/luals/meta/default utf8/System.ComponentModel.lua +0 -4997
  796. package/payload/tool/luals/meta/default utf8/System.Configuration.Assemblies.lua +0 -61
  797. package/payload/tool/luals/meta/default utf8/System.Configuration.lua +0 -926
  798. package/payload/tool/luals/meta/default utf8/System.Data.Common.lua +0 -1823
  799. package/payload/tool/luals/meta/default utf8/System.Data.Odbc.lua +0 -931
  800. package/payload/tool/luals/meta/default utf8/System.Data.OleDb.lua +0 -1156
  801. package/payload/tool/luals/meta/default utf8/System.Data.Sql.lua +0 -24
  802. package/payload/tool/luals/meta/default utf8/System.Data.SqlClient.lua +0 -1959
  803. package/payload/tool/luals/meta/default utf8/System.Data.SqlTypes.lua +0 -4007
  804. package/payload/tool/luals/meta/default utf8/System.Data.lua +0 -3614
  805. package/payload/tool/luals/meta/default utf8/System.Deployment.Internal.lua +0 -49
  806. package/payload/tool/luals/meta/default utf8/System.Diagnostics.CodeAnalysis.lua +0 -24
  807. package/payload/tool/luals/meta/default utf8/System.Diagnostics.Contracts.Internal.lua +0 -22
  808. package/payload/tool/luals/meta/default utf8/System.Diagnostics.Contracts.lua +0 -251
  809. package/payload/tool/luals/meta/default utf8/System.Diagnostics.Eventing.Reader.lua +0 -744
  810. package/payload/tool/luals/meta/default utf8/System.Diagnostics.Eventing.lua +0 -179
  811. package/payload/tool/luals/meta/default utf8/System.Diagnostics.PerformanceData.lua +0 -155
  812. package/payload/tool/luals/meta/default utf8/System.Diagnostics.SymbolStore.lua +0 -485
  813. package/payload/tool/luals/meta/default utf8/System.Diagnostics.Tracing.lua +0 -591
  814. package/payload/tool/luals/meta/default utf8/System.Diagnostics.lua +0 -3178
  815. package/payload/tool/luals/meta/default utf8/System.Dynamic.lua +0 -672
  816. package/payload/tool/luals/meta/default utf8/System.Globalization.lua +0 -3076
  817. package/payload/tool/luals/meta/default utf8/System.IO.Compression.lua +0 -249
  818. package/payload/tool/luals/meta/default utf8/System.IO.IsolatedStorage.lua +0 -400
  819. package/payload/tool/luals/meta/default utf8/System.IO.MemoryMappedFiles.lua +0 -302
  820. package/payload/tool/luals/meta/default utf8/System.IO.Pipes.lua +0 -412
  821. package/payload/tool/luals/meta/default utf8/System.IO.Ports.lua +0 -367
  822. package/payload/tool/luals/meta/default utf8/System.IO.lua +0 -2977
  823. package/payload/tool/luals/meta/default utf8/System.Linq.Expressions.lua +0 -3141
  824. package/payload/tool/luals/meta/default utf8/System.Linq.lua +0 -2737
  825. package/payload/tool/luals/meta/default utf8/System.Management.Instrumentation.lua +0 -180
  826. package/payload/tool/luals/meta/default utf8/System.Media.lua +0 -89
  827. package/payload/tool/luals/meta/default utf8/System.Net.Cache.lua +0 -109
  828. package/payload/tool/luals/meta/default utf8/System.Net.Configuration.lua +0 -564
  829. package/payload/tool/luals/meta/default utf8/System.Net.Http.Headers.lua +0 -950
  830. package/payload/tool/luals/meta/default utf8/System.Net.Http.lua +0 -529
  831. package/payload/tool/luals/meta/default utf8/System.Net.Mail.lua +0 -566
  832. package/payload/tool/luals/meta/default utf8/System.Net.Mime.lua +0 -143
  833. package/payload/tool/luals/meta/default utf8/System.Net.NetworkInformation.lua +0 -1500
  834. package/payload/tool/luals/meta/default utf8/System.Net.Security.lua +0 -677
  835. package/payload/tool/luals/meta/default utf8/System.Net.Sockets.lua +0 -2133
  836. package/payload/tool/luals/meta/default utf8/System.Net.WebSockets.lua +0 -368
  837. package/payload/tool/luals/meta/default utf8/System.Net.lua +0 -3584
  838. package/payload/tool/luals/meta/default utf8/System.Numerics.lua +0 -2511
  839. package/payload/tool/luals/meta/default utf8/System.Reflection.Emit.lua +0 -3816
  840. package/payload/tool/luals/meta/default utf8/System.Reflection.lua +0 -2924
  841. package/payload/tool/luals/meta/default utf8/System.Resources.lua +0 -270
  842. package/payload/tool/luals/meta/default utf8/System.Runtime.CompilerServices.lua +0 -1317
  843. package/payload/tool/luals/meta/default utf8/System.Runtime.ConstrainedExecution.lua +0 -58
  844. package/payload/tool/luals/meta/default utf8/System.Runtime.DesignerServices.lua +0 -26
  845. package/payload/tool/luals/meta/default utf8/System.Runtime.ExceptionServices.lua +0 -30
  846. package/payload/tool/luals/meta/default utf8/System.Runtime.Hosting.lua +0 -33
  847. package/payload/tool/luals/meta/default utf8/System.Runtime.InteropServices.ComTypes.lua +0 -1839
  848. package/payload/tool/luals/meta/default utf8/System.Runtime.InteropServices.Expando.lua +0 -26
  849. package/payload/tool/luals/meta/default utf8/System.Runtime.InteropServices.WindowsRuntime.lua +0 -208
  850. package/payload/tool/luals/meta/default utf8/System.Runtime.InteropServices.lua +0 -6387
  851. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Activation.lua +0 -85
  852. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Channels.lua +0 -552
  853. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Contexts.lua +0 -321
  854. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Lifetime.lua +0 -109
  855. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Messaging.lua +0 -680
  856. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Metadata.W3cXsd2001.lua +0 -723
  857. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Metadata.lua +0 -110
  858. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Proxies.lua +0 -87
  859. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.Services.lua +0 -58
  860. package/payload/tool/luals/meta/default utf8/System.Runtime.Remoting.lua +0 -612
  861. package/payload/tool/luals/meta/default utf8/System.Runtime.Serialization.Configuration.lua +0 -169
  862. package/payload/tool/luals/meta/default utf8/System.Runtime.Serialization.Formatters.Binary.lua +0 -60
  863. package/payload/tool/luals/meta/default utf8/System.Runtime.Serialization.Formatters.lua +0 -172
  864. package/payload/tool/luals/meta/default utf8/System.Runtime.Serialization.Json.lua +0 -239
  865. package/payload/tool/luals/meta/default utf8/System.Runtime.Serialization.lua +0 -1581
  866. package/payload/tool/luals/meta/default utf8/System.Runtime.Versioning.lua +0 -145
  867. package/payload/tool/luals/meta/default utf8/System.Runtime.lua +0 -87
  868. package/payload/tool/luals/meta/default utf8/System.Security.AccessControl.lua +0 -2112
  869. package/payload/tool/luals/meta/default utf8/System.Security.Authentication.ExtendedProtection.Configuration.lua +0 -58
  870. package/payload/tool/luals/meta/default utf8/System.Security.Authentication.ExtendedProtection.lua +0 -144
  871. package/payload/tool/luals/meta/default utf8/System.Security.Authentication.lua +0 -87
  872. package/payload/tool/luals/meta/default utf8/System.Security.Claims.lua +0 -378
  873. package/payload/tool/luals/meta/default utf8/System.Security.Cryptography.X509Certificates.lua +0 -1235
  874. package/payload/tool/luals/meta/default utf8/System.Security.Cryptography.lua +0 -3923
  875. package/payload/tool/luals/meta/default utf8/System.Security.Permissions.lua +0 -1720
  876. package/payload/tool/luals/meta/default utf8/System.Security.Policy.lua +0 -1384
  877. package/payload/tool/luals/meta/default utf8/System.Security.Principal.lua +0 -589
  878. package/payload/tool/luals/meta/default utf8/System.Security.lua +0 -939
  879. package/payload/tool/luals/meta/default utf8/System.Text.RegularExpressions.lua +0 -520
  880. package/payload/tool/luals/meta/default utf8/System.Text.lua +0 -1712
  881. package/payload/tool/luals/meta/default utf8/System.Threading.Tasks.lua +0 -1899
  882. package/payload/tool/luals/meta/default utf8/System.Threading.lua +0 -2558
  883. package/payload/tool/luals/meta/default utf8/System.Timers.lua +0 -80
  884. package/payload/tool/luals/meta/default utf8/System.Web.lua +0 -74
  885. package/payload/tool/luals/meta/default utf8/System.Windows.Input.lua +0 -25
  886. package/payload/tool/luals/meta/default utf8/System.Windows.Markup.lua +0 -10
  887. package/payload/tool/luals/meta/default utf8/System.Xml.Linq.lua +0 -1307
  888. package/payload/tool/luals/meta/default utf8/System.Xml.Resolvers.lua +0 -81
  889. package/payload/tool/luals/meta/default utf8/System.Xml.Schema.lua +0 -1738
  890. package/payload/tool/luals/meta/default utf8/System.Xml.Serialization.Advanced.lua +0 -99
  891. package/payload/tool/luals/meta/default utf8/System.Xml.Serialization.Configuration.lua +0 -116
  892. package/payload/tool/luals/meta/default utf8/System.Xml.Serialization.lua +0 -1756
  893. package/payload/tool/luals/meta/default utf8/System.Xml.XPath.lua +0 -791
  894. package/payload/tool/luals/meta/default utf8/System.Xml.XmlConfiguration.lua +0 -18
  895. package/payload/tool/luals/meta/default utf8/System.Xml.Xsl.lua +0 -522
  896. package/payload/tool/luals/meta/default utf8/System.Xml.lua +0 -5751
  897. package/payload/tool/luals/meta/default utf8/System.lua +0 -16165
  898. package/payload/tool/luals/meta/default utf8/UnityEngine.AI.lua +0 -1625
  899. package/payload/tool/luals/meta/default utf8/UnityEngine.Accessibility.lua +0 -26
  900. package/payload/tool/luals/meta/default utf8/UnityEngine.Analytics.lua +0 -2323
  901. package/payload/tool/luals/meta/default utf8/UnityEngine.Android.lua +0 -596
  902. package/payload/tool/luals/meta/default utf8/UnityEngine.Animations.lua +0 -3555
  903. package/payload/tool/luals/meta/default utf8/UnityEngine.Apple.ReplayKit.lua +0 -201
  904. package/payload/tool/luals/meta/default utf8/UnityEngine.Apple.TV.lua +0 -14
  905. package/payload/tool/luals/meta/default utf8/UnityEngine.Apple.lua +0 -74
  906. package/payload/tool/luals/meta/default utf8/UnityEngine.Assertions.Comparers.lua +0 -64
  907. package/payload/tool/luals/meta/default utf8/UnityEngine.Assertions.Must.lua +0 -131
  908. package/payload/tool/luals/meta/default utf8/UnityEngine.Assertions.lua +0 -937
  909. package/payload/tool/luals/meta/default utf8/UnityEngine.Audio.lua +0 -371
  910. package/payload/tool/luals/meta/default utf8/UnityEngine.Build.Pipeline.lua +0 -84
  911. package/payload/tool/luals/meta/default utf8/UnityEngine.CrashReportHandler.lua +0 -35
  912. package/payload/tool/luals/meta/default utf8/UnityEngine.Diagnostics.lua +0 -91
  913. package/payload/tool/luals/meta/default utf8/UnityEngine.EventSystems.lua +0 -959
  914. package/payload/tool/luals/meta/default utf8/UnityEngine.Events.lua +0 -425
  915. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.AI.lua +0 -426
  916. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.Animations.lua +0 -74
  917. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.AssetBundlePatching.lua +0 -11
  918. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.Audio.lua +0 -231
  919. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.GlobalIllumination.lua +0 -957
  920. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.Playables.lua +0 -210
  921. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.Rendering.lua +0 -2058
  922. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.TerrainAPI.lua +0 -905
  923. package/payload/tool/luals/meta/default utf8/UnityEngine.Experimental.Video.lua +0 -107
  924. package/payload/tool/luals/meta/default utf8/UnityEngine.Internal.lua +0 -23
  925. package/payload/tool/luals/meta/default utf8/UnityEngine.Jobs.lua +0 -169
  926. package/payload/tool/luals/meta/default utf8/UnityEngine.LowLevel.lua +0 -87
  927. package/payload/tool/luals/meta/default utf8/UnityEngine.Lumin.lua +0 -11
  928. package/payload/tool/luals/meta/default utf8/UnityEngine.Networking.Match.lua +0 -272
  929. package/payload/tool/luals/meta/default utf8/UnityEngine.Networking.PlayerConnection.lua +0 -110
  930. package/payload/tool/luals/meta/default utf8/UnityEngine.Networking.Types.lua +0 -157
  931. package/payload/tool/luals/meta/default utf8/UnityEngine.Networking.lua +0 -2772
  932. package/payload/tool/luals/meta/default utf8/UnityEngine.ParticleSystemJobs.lua +0 -222
  933. package/payload/tool/luals/meta/default utf8/UnityEngine.Playables.lua +0 -1646
  934. package/payload/tool/luals/meta/default utf8/UnityEngine.PlayerLoop.lua +0 -1161
  935. package/payload/tool/luals/meta/default utf8/UnityEngine.Profiling.Experimental.lua +0 -29
  936. package/payload/tool/luals/meta/default utf8/UnityEngine.Profiling.Memory.Experimental.lua +0 -95
  937. package/payload/tool/luals/meta/default utf8/UnityEngine.Profiling.lua +0 -564
  938. package/payload/tool/luals/meta/default utf8/UnityEngine.Rendering.PostProcessing.lua +0 -2145
  939. package/payload/tool/luals/meta/default utf8/UnityEngine.Rendering.VirtualTexturing.lua +0 -673
  940. package/payload/tool/luals/meta/default utf8/UnityEngine.Rendering.lua +0 -11996
  941. package/payload/tool/luals/meta/default utf8/UnityEngine.SceneManagement.lua +0 -715
  942. package/payload/tool/luals/meta/default utf8/UnityEngine.Scripting.APIUpdating.lua +0 -8
  943. package/payload/tool/luals/meta/default utf8/UnityEngine.Scripting.lua +0 -139
  944. package/payload/tool/luals/meta/default utf8/UnityEngine.SearchService.lua +0 -33
  945. package/payload/tool/luals/meta/default utf8/UnityEngine.Serialization.lua +0 -35
  946. package/payload/tool/luals/meta/default utf8/UnityEngine.SocialPlatforms.GameCenter.lua +0 -84
  947. package/payload/tool/luals/meta/default utf8/UnityEngine.SocialPlatforms.Impl.lua +0 -252
  948. package/payload/tool/luals/meta/default utf8/UnityEngine.SocialPlatforms.lua +0 -487
  949. package/payload/tool/luals/meta/default utf8/UnityEngine.Sprites.lua +0 -41
  950. package/payload/tool/luals/meta/default utf8/UnityEngine.Subsystems.lua +0 -27
  951. package/payload/tool/luals/meta/default utf8/UnityEngine.SubsystemsImplementation.Extensions.lua +0 -20
  952. package/payload/tool/luals/meta/default utf8/UnityEngine.SubsystemsImplementation.lua +0 -125
  953. package/payload/tool/luals/meta/default utf8/UnityEngine.TestTools.lua +0 -163
  954. package/payload/tool/luals/meta/default utf8/UnityEngine.TextCore.LowLevel.lua +0 -680
  955. package/payload/tool/luals/meta/default utf8/UnityEngine.TextCore.lua +0 -284
  956. package/payload/tool/luals/meta/default utf8/UnityEngine.Tilemaps.lua +0 -1278
  957. package/payload/tool/luals/meta/default utf8/UnityEngine.Timeline.lua +0 -1386
  958. package/payload/tool/luals/meta/default utf8/UnityEngine.U2D.lua +0 -582
  959. package/payload/tool/luals/meta/default utf8/UnityEngine.UI.lua +0 -2813
  960. package/payload/tool/luals/meta/default utf8/UnityEngine.UIElements.Experimental.lua +0 -575
  961. package/payload/tool/luals/meta/default utf8/UnityEngine.UIElements.lua +0 -8986
  962. package/payload/tool/luals/meta/default utf8/UnityEngine.VFX.lua +0 -2888
  963. package/payload/tool/luals/meta/default utf8/UnityEngine.Video.lua +0 -927
  964. package/payload/tool/luals/meta/default utf8/UnityEngine.WSA.lua +0 -1018
  965. package/payload/tool/luals/meta/default utf8/UnityEngine.Windows.Speech.lua +0 -667
  966. package/payload/tool/luals/meta/default utf8/UnityEngine.Windows.WebCam.lua +0 -756
  967. package/payload/tool/luals/meta/default utf8/UnityEngine.Windows.lua +0 -189
  968. package/payload/tool/luals/meta/default utf8/UnityEngine.XR.Provider.lua +0 -16
  969. package/payload/tool/luals/meta/default utf8/UnityEngine.XR.WSA.lua +0 -15
  970. package/payload/tool/luals/meta/default utf8/UnityEngine.XR.lua +0 -2757
  971. package/payload/tool/luals/meta/default utf8/UnityEngine.iOS.lua +0 -1359
  972. package/payload/tool/luals/meta/default utf8/UnityEngine.lua +0 -78477
  973. package/payload/tool/luals/meta/default utf8/UnityEngine.tvOS.lua +0 -119
  974. package/payload/tool/luals/meta/default utf8/UnityEngineInternal.XR.WSA.lua +0 -13
  975. package/payload/tool/luals/meta/default utf8/UnityEngineInternal.lua +0 -158
  976. package/payload/tool/luals/meta/spell/dictionary.txt +0 -82834
  977. package/payload/tool/luals/meta/spell/lua_dict.txt +0 -230
  978. package/payload/tool/luals/meta/template/basic.lua +0 -404
  979. package/payload/tool/luals/meta/template/bit.lua +0 -77
  980. package/payload/tool/luals/meta/template/bit32.lua +0 -86
  981. package/payload/tool/luals/meta/template/builtin.lua +0 -16
  982. package/payload/tool/luals/meta/template/coroutine.lua +0 -68
  983. package/payload/tool/luals/meta/template/debug.lua +0 -221
  984. package/payload/tool/luals/meta/template/ffi.lua +0 -122
  985. package/payload/tool/luals/meta/template/io.lua +0 -170
  986. package/payload/tool/luals/meta/template/jit.lua +0 -43
  987. package/payload/tool/luals/meta/template/jit.profile.lua +0 -20
  988. package/payload/tool/luals/meta/template/jit.util.lua +0 -120
  989. package/payload/tool/luals/meta/template/math.lua +0 -255
  990. package/payload/tool/luals/meta/template/os.lua +0 -136
  991. package/payload/tool/luals/meta/template/package.lua +0 -66
  992. package/payload/tool/luals/meta/template/string.buffer.lua +0 -354
  993. package/payload/tool/luals/meta/template/string.lua +0 -161
  994. package/payload/tool/luals/meta/template/table.clear.lua +0 -9
  995. package/payload/tool/luals/meta/template/table.lua +0 -114
  996. package/payload/tool/luals/meta/template/table.new.lua +0 -11
  997. package/payload/tool/luals/meta/template/utf8.lua +0 -91
  998. package/payload/tool/luals/meta/whimsical/basic.lua +0 -50
  999. package/payload/tool/luals/meta/whimsical/builtin.lua +0 -18
  1000. package/payload/tool/luals/meta/whimsical/rule.lua +0 -128
  1001. package/payload/tool/luals/runtime.json +0 -1
  1002. package/payload/tool/luals/script/SDBMHash.lua +0 -60
  1003. package/payload/tool/luals/script/await.lua +0 -267
  1004. package/payload/tool/luals/script/brave/brave.lua +0 -84
  1005. package/payload/tool/luals/script/brave/init.lua +0 -4
  1006. package/payload/tool/luals/script/brave/log.lua +0 -55
  1007. package/payload/tool/luals/script/brave/work.lua +0 -125
  1008. package/payload/tool/luals/script/cli/check.lua +0 -120
  1009. package/payload/tool/luals/script/cli/check_worker.lua +0 -295
  1010. package/payload/tool/luals/script/cli/doc/export.lua +0 -362
  1011. package/payload/tool/luals/script/cli/doc/init.lua +0 -258
  1012. package/payload/tool/luals/script/cli/help.lua +0 -170
  1013. package/payload/tool/luals/script/cli/init.lua +0 -34
  1014. package/payload/tool/luals/script/cli/version.lua +0 -2
  1015. package/payload/tool/luals/script/cli/visualize.lua +0 -106
  1016. package/payload/tool/luals/script/client.lua +0 -668
  1017. package/payload/tool/luals/script/config/config.lua +0 -277
  1018. package/payload/tool/luals/script/config/env.lua +0 -67
  1019. package/payload/tool/luals/script/config/init.lua +0 -3
  1020. package/payload/tool/luals/script/config/loader.lua +0 -131
  1021. package/payload/tool/luals/script/config/template.lua +0 -462
  1022. package/payload/tool/luals/script/core/code-action.lua +0 -749
  1023. package/payload/tool/luals/script/core/code-lens.lua +0 -166
  1024. package/payload/tool/luals/script/core/color.lua +0 -97
  1025. package/payload/tool/luals/script/core/command/autoRequire.lua +0 -164
  1026. package/payload/tool/luals/script/core/command/exportDocument.lua +0 -15
  1027. package/payload/tool/luals/script/core/command/getConfig.lua +0 -13
  1028. package/payload/tool/luals/script/core/command/jsonToLua.lua +0 -54
  1029. package/payload/tool/luals/script/core/command/reloadFFIMeta.lua +0 -56
  1030. package/payload/tool/luals/script/core/command/removeSpace.lua +0 -60
  1031. package/payload/tool/luals/script/core/command/setConfig.lua +0 -11
  1032. package/payload/tool/luals/script/core/command/solve.lua +0 -99
  1033. package/payload/tool/luals/script/core/completion/auto-require.lua +0 -168
  1034. package/payload/tool/luals/script/core/completion/completion.lua +0 -2408
  1035. package/payload/tool/luals/script/core/completion/init.lua +0 -1
  1036. package/payload/tool/luals/script/core/completion/keyword.lua +0 -409
  1037. package/payload/tool/luals/script/core/completion/postfix.lua +0 -413
  1038. package/payload/tool/luals/script/core/definition.lua +0 -238
  1039. package/payload/tool/luals/script/core/diagnostics/ambiguity-1.lua +0 -79
  1040. package/payload/tool/luals/script/core/diagnostics/assign-type-mismatch.lua +0 -121
  1041. package/payload/tool/luals/script/core/diagnostics/await-in-sync.lua +0 -30
  1042. package/payload/tool/luals/script/core/diagnostics/cast-local-type.lua +0 -54
  1043. package/payload/tool/luals/script/core/diagnostics/cast-type-mismatch.lua +0 -46
  1044. package/payload/tool/luals/script/core/diagnostics/circle-doc-class.lua +0 -58
  1045. package/payload/tool/luals/script/core/diagnostics/close-non-object.lua +0 -40
  1046. package/payload/tool/luals/script/core/diagnostics/code-after-break.lua +0 -38
  1047. package/payload/tool/luals/script/core/diagnostics/codestyle-check.lua +0 -41
  1048. package/payload/tool/luals/script/core/diagnostics/count-down-loop.lua +0 -51
  1049. package/payload/tool/luals/script/core/diagnostics/deprecated.lua +0 -82
  1050. package/payload/tool/luals/script/core/diagnostics/different-requires.lua +0 -54
  1051. package/payload/tool/luals/script/core/diagnostics/discard-returns.lua +0 -30
  1052. package/payload/tool/luals/script/core/diagnostics/doc-field-no-class.lua +0 -41
  1053. package/payload/tool/luals/script/core/diagnostics/duplicate-doc-alias.lua +0 -54
  1054. package/payload/tool/luals/script/core/diagnostics/duplicate-doc-field.lua +0 -94
  1055. package/payload/tool/luals/script/core/diagnostics/duplicate-doc-param.lua +0 -37
  1056. package/payload/tool/luals/script/core/diagnostics/duplicate-index.lua +0 -65
  1057. package/payload/tool/luals/script/core/diagnostics/duplicate-set-field.lua +0 -101
  1058. package/payload/tool/luals/script/core/diagnostics/empty-block.lua +0 -54
  1059. package/payload/tool/luals/script/core/diagnostics/global-element.lua +0 -76
  1060. package/payload/tool/luals/script/core/diagnostics/global-in-nil-env.lua +0 -42
  1061. package/payload/tool/luals/script/core/diagnostics/helper/missing-doc-helper.lua +0 -83
  1062. package/payload/tool/luals/script/core/diagnostics/incomplete-signature-doc.lua +0 -109
  1063. package/payload/tool/luals/script/core/diagnostics/init.lua +0 -191
  1064. package/payload/tool/luals/script/core/diagnostics/inject-field.lua +0 -150
  1065. package/payload/tool/luals/script/core/diagnostics/invisible.lua +0 -67
  1066. package/payload/tool/luals/script/core/diagnostics/lowercase-global.lua +0 -85
  1067. package/payload/tool/luals/script/core/diagnostics/missing-fields.lua +0 -118
  1068. package/payload/tool/luals/script/core/diagnostics/missing-global-doc.lua +0 -27
  1069. package/payload/tool/luals/script/core/diagnostics/missing-local-export-doc.lua +0 -52
  1070. package/payload/tool/luals/script/core/diagnostics/missing-parameter.lua +0 -32
  1071. package/payload/tool/luals/script/core/diagnostics/missing-return-value.lua +0 -51
  1072. package/payload/tool/luals/script/core/diagnostics/missing-return.lua +0 -76
  1073. package/payload/tool/luals/script/core/diagnostics/name-style-check.lua +0 -35
  1074. package/payload/tool/luals/script/core/diagnostics/need-check-nil.lua +0 -48
  1075. package/payload/tool/luals/script/core/diagnostics/newfield-call.lua +0 -49
  1076. package/payload/tool/luals/script/core/diagnostics/newline-call.lua +0 -54
  1077. package/payload/tool/luals/script/core/diagnostics/no-unknown.lua +0 -36
  1078. package/payload/tool/luals/script/core/diagnostics/not-yieldable.lua +0 -63
  1079. package/payload/tool/luals/script/core/diagnostics/param-type-mismatch.lua +0 -176
  1080. package/payload/tool/luals/script/core/diagnostics/redefined-local.lua +0 -37
  1081. package/payload/tool/luals/script/core/diagnostics/redundant-parameter.lua +0 -73
  1082. package/payload/tool/luals/script/core/diagnostics/redundant-return-value.lua +0 -58
  1083. package/payload/tool/luals/script/core/diagnostics/redundant-return.lua +0 -27
  1084. package/payload/tool/luals/script/core/diagnostics/redundant-value.lua +0 -26
  1085. package/payload/tool/luals/script/core/diagnostics/return-type-mismatch.lua +0 -94
  1086. package/payload/tool/luals/script/core/diagnostics/spell-check.lua +0 -35
  1087. package/payload/tool/luals/script/core/diagnostics/trailing-space.lua +0 -53
  1088. package/payload/tool/luals/script/core/diagnostics/unbalanced-assignments.lua +0 -49
  1089. package/payload/tool/luals/script/core/diagnostics/undefined-doc-class.lua +0 -48
  1090. package/payload/tool/luals/script/core/diagnostics/undefined-doc-name.lua +0 -134
  1091. package/payload/tool/luals/script/core/diagnostics/undefined-doc-param.lua +0 -24
  1092. package/payload/tool/luals/script/core/diagnostics/undefined-env-child.lua +0 -50
  1093. package/payload/tool/luals/script/core/diagnostics/undefined-field.lua +0 -90
  1094. package/payload/tool/luals/script/core/diagnostics/undefined-global.lua +0 -37
  1095. package/payload/tool/luals/script/core/diagnostics/unknown-cast-variable.lua +0 -31
  1096. package/payload/tool/luals/script/core/diagnostics/unknown-diag-code.lua +0 -31
  1097. package/payload/tool/luals/script/core/diagnostics/unknown-operator.lua +0 -33
  1098. package/payload/tool/luals/script/core/diagnostics/unnecessary-assert.lua +0 -29
  1099. package/payload/tool/luals/script/core/diagnostics/unreachable-code.lua +0 -84
  1100. package/payload/tool/luals/script/core/diagnostics/unused-function.lua +0 -129
  1101. package/payload/tool/luals/script/core/diagnostics/unused-label.lua +0 -22
  1102. package/payload/tool/luals/script/core/diagnostics/unused-local.lua +0 -130
  1103. package/payload/tool/luals/script/core/diagnostics/unused-vararg.lua +0 -39
  1104. package/payload/tool/luals/script/core/document-symbol.lua +0 -411
  1105. package/payload/tool/luals/script/core/find-source.lua +0 -33
  1106. package/payload/tool/luals/script/core/fix-indent.lua +0 -188
  1107. package/payload/tool/luals/script/core/folding.lua +0 -184
  1108. package/payload/tool/luals/script/core/formatting.lua +0 -35
  1109. package/payload/tool/luals/script/core/highlight.lua +0 -368
  1110. package/payload/tool/luals/script/core/hint.lua +0 -340
  1111. package/payload/tool/luals/script/core/hover/args.lua +0 -85
  1112. package/payload/tool/luals/script/core/hover/description.lua +0 -545
  1113. package/payload/tool/luals/script/core/hover/init.lua +0 -165
  1114. package/payload/tool/luals/script/core/hover/label.lua +0 -234
  1115. package/payload/tool/luals/script/core/hover/name.lua +0 -104
  1116. package/payload/tool/luals/script/core/hover/return.lua +0 -84
  1117. package/payload/tool/luals/script/core/hover/table.lua +0 -232
  1118. package/payload/tool/luals/script/core/implementation.lua +0 -170
  1119. package/payload/tool/luals/script/core/jump-source.lua +0 -62
  1120. package/payload/tool/luals/script/core/look-backward.lua +0 -102
  1121. package/payload/tool/luals/script/core/matchkey.lua +0 -85
  1122. package/payload/tool/luals/script/core/modifyRequirePath.lua +0 -74
  1123. package/payload/tool/luals/script/core/rangeformatting.lua +0 -33
  1124. package/payload/tool/luals/script/core/reference.lua +0 -160
  1125. package/payload/tool/luals/script/core/rename.lua +0 -466
  1126. package/payload/tool/luals/script/core/semantic-tokens.lua +0 -951
  1127. package/payload/tool/luals/script/core/signature.lua +0 -227
  1128. package/payload/tool/luals/script/core/substring.lua +0 -13
  1129. package/payload/tool/luals/script/core/type-definition.lua +0 -176
  1130. package/payload/tool/luals/script/core/type-formatting.lua +0 -49
  1131. package/payload/tool/luals/script/core/view/psi-select.lua +0 -13
  1132. package/payload/tool/luals/script/core/view/psi-view.lua +0 -96
  1133. package/payload/tool/luals/script/core/workspace-symbol.lua +0 -161
  1134. package/payload/tool/luals/script/doctor.lua +0 -625
  1135. package/payload/tool/luals/script/encoder/ansi.lua +0 -24
  1136. package/payload/tool/luals/script/encoder/init.lua +0 -123
  1137. package/payload/tool/luals/script/encoder/utf16.lua +0 -157
  1138. package/payload/tool/luals/script/file-uri.lua +0 -118
  1139. package/payload/tool/luals/script/files.lua +0 -999
  1140. package/payload/tool/luals/script/filewatch.lua +0 -129
  1141. package/payload/tool/luals/script/fs-utility.lua +0 -667
  1142. package/payload/tool/luals/script/gc.lua +0 -121
  1143. package/payload/tool/luals/script/glob/gitignore.lua +0 -251
  1144. package/payload/tool/luals/script/glob/glob.lua +0 -125
  1145. package/payload/tool/luals/script/glob/init.lua +0 -4
  1146. package/payload/tool/luals/script/glob/matcher.lua +0 -159
  1147. package/payload/tool/luals/script/global.d.lua +0 -113
  1148. package/payload/tool/luals/script/inspect.lua +0 -337
  1149. package/payload/tool/luals/script/json-beautify.lua +0 -176
  1150. package/payload/tool/luals/script/json-edit.lua +0 -725
  1151. package/payload/tool/luals/script/json.lua +0 -555
  1152. package/payload/tool/luals/script/jsonc.lua +0 -374
  1153. package/payload/tool/luals/script/jsonrpc.lua +0 -73
  1154. package/payload/tool/luals/script/language.lua +0 -144
  1155. package/payload/tool/luals/script/lazy-cacher.lua +0 -171
  1156. package/payload/tool/luals/script/lazytable.lua +0 -351
  1157. package/payload/tool/luals/script/lclient.lua +0 -268
  1158. package/payload/tool/luals/script/library.lua +0 -672
  1159. package/payload/tool/luals/script/linked-table.lua +0 -227
  1160. package/payload/tool/luals/script/locale-loader.lua +0 -28
  1161. package/payload/tool/luals/script/log.lua +0 -165
  1162. package/payload/tool/luals/script/meta/bee/channel.lua +0 -36
  1163. package/payload/tool/luals/script/meta/bee/filesystem.lua +0 -117
  1164. package/payload/tool/luals/script/meta/bee/filewatch.lua +0 -32
  1165. package/payload/tool/luals/script/meta/bee/select.lua +0 -46
  1166. package/payload/tool/luals/script/meta/bee/socket.lua +0 -73
  1167. package/payload/tool/luals/script/meta/bee/sys.lua +0 -19
  1168. package/payload/tool/luals/script/meta/bee/thread.lua +0 -52
  1169. package/payload/tool/luals/script/parser/compile.lua +0 -5164
  1170. package/payload/tool/luals/script/parser/guide.lua +0 -1364
  1171. package/payload/tool/luals/script/parser/init.lua +0 -8
  1172. package/payload/tool/luals/script/parser/lines.lua +0 -25
  1173. package/payload/tool/luals/script/parser/luadoc.lua +0 -2424
  1174. package/payload/tool/luals/script/parser/relabel.lua +0 -360
  1175. package/payload/tool/luals/script/parser/tokens.lua +0 -56
  1176. package/payload/tool/luals/script/plugin.lua +0 -176
  1177. package/payload/tool/luals/script/plugins/astHelper.lua +0 -96
  1178. package/payload/tool/luals/script/plugins/ffi/c-parser/c99.lua +0 -731
  1179. package/payload/tool/luals/script/plugins/ffi/c-parser/cdefines.lua +0 -152
  1180. package/payload/tool/luals/script/plugins/ffi/c-parser/cdriver.lua +0 -54
  1181. package/payload/tool/luals/script/plugins/ffi/c-parser/cpp.lua +0 -870
  1182. package/payload/tool/luals/script/plugins/ffi/c-parser/ctypes.lua +0 -604
  1183. package/payload/tool/luals/script/plugins/ffi/c-parser/typed.lua +0 -172
  1184. package/payload/tool/luals/script/plugins/ffi/c-parser/util.lua +0 -28
  1185. package/payload/tool/luals/script/plugins/ffi/cdefRerence.lua +0 -37
  1186. package/payload/tool/luals/script/plugins/ffi/init.lua +0 -373
  1187. package/payload/tool/luals/script/plugins/ffi/searchCode.lua +0 -69
  1188. package/payload/tool/luals/script/plugins/init.lua +0 -1
  1189. package/payload/tool/luals/script/plugins/nodeHelper.lua +0 -72
  1190. package/payload/tool/luals/script/progress.lua +0 -182
  1191. package/payload/tool/luals/script/proto/converter.lua +0 -235
  1192. package/payload/tool/luals/script/proto/define.lua +0 -197
  1193. package/payload/tool/luals/script/proto/diagnostic.lua +0 -306
  1194. package/payload/tool/luals/script/proto/init.lua +0 -3
  1195. package/payload/tool/luals/script/proto/proto.lua +0 -308
  1196. package/payload/tool/luals/script/provider/build-meta.lua +0 -153
  1197. package/payload/tool/luals/script/provider/capability.lua +0 -84
  1198. package/payload/tool/luals/script/provider/code-lens.lua +0 -29
  1199. package/payload/tool/luals/script/provider/completion.lua +0 -104
  1200. package/payload/tool/luals/script/provider/diagnostic.lua +0 -727
  1201. package/payload/tool/luals/script/provider/formatting.lua +0 -101
  1202. package/payload/tool/luals/script/provider/init.lua +0 -2
  1203. package/payload/tool/luals/script/provider/inlay-hint.lua +0 -29
  1204. package/payload/tool/luals/script/provider/language-configuration.lua +0 -113
  1205. package/payload/tool/luals/script/provider/markdown.lua +0 -163
  1206. package/payload/tool/luals/script/provider/name-style.lua +0 -28
  1207. package/payload/tool/luals/script/provider/provider.lua +0 -1671
  1208. package/payload/tool/luals/script/provider/semantic-tokens.lua +0 -29
  1209. package/payload/tool/luals/script/provider/spell.lua +0 -51
  1210. package/payload/tool/luals/script/pub/init.lua +0 -4
  1211. package/payload/tool/luals/script/pub/pub.lua +0 -290
  1212. package/payload/tool/luals/script/pub/report.lua +0 -28
  1213. package/payload/tool/luals/script/service/init.lua +0 -3
  1214. package/payload/tool/luals/script/service/net.lua +0 -275
  1215. package/payload/tool/luals/script/service/service.lua +0 -290
  1216. package/payload/tool/luals/script/string-merger.lua +0 -148
  1217. package/payload/tool/luals/script/text-merger.lua +0 -115
  1218. package/payload/tool/luals/script/timer.lua +0 -244
  1219. package/payload/tool/luals/script/tracy.lua +0 -32
  1220. package/payload/tool/luals/script/utility.lua +0 -1354
  1221. package/payload/tool/luals/script/version.lua +0 -30
  1222. package/payload/tool/luals/script/vm/compiler.lua +0 -2744
  1223. package/payload/tool/luals/script/vm/def.lua +0 -133
  1224. package/payload/tool/luals/script/vm/doc.lua +0 -526
  1225. package/payload/tool/luals/script/vm/field.lua +0 -59
  1226. package/payload/tool/luals/script/vm/function.lua +0 -533
  1227. package/payload/tool/luals/script/vm/generic.lua +0 -278
  1228. package/payload/tool/luals/script/vm/global.lua +0 -758
  1229. package/payload/tool/luals/script/vm/infer.lua +0 -621
  1230. package/payload/tool/luals/script/vm/init.lua +0 -25
  1231. package/payload/tool/luals/script/vm/library.lua +0 -15
  1232. package/payload/tool/luals/script/vm/node.lua +0 -537
  1233. package/payload/tool/luals/script/vm/operator.lua +0 -530
  1234. package/payload/tool/luals/script/vm/precompile.lua +0 -20
  1235. package/payload/tool/luals/script/vm/ref.lua +0 -328
  1236. package/payload/tool/luals/script/vm/sign.lua +0 -454
  1237. package/payload/tool/luals/script/vm/tracer.lua +0 -947
  1238. package/payload/tool/luals/script/vm/type.lua +0 -930
  1239. package/payload/tool/luals/script/vm/value.lua +0 -258
  1240. package/payload/tool/luals/script/vm/variable.lua +0 -411
  1241. package/payload/tool/luals/script/vm/visible.lua +0 -208
  1242. package/payload/tool/luals/script/vm/vm.lua +0 -119
  1243. package/payload/tool/luals/script/without-check-nil.lua +0 -126
  1244. package/payload/tool/luals/script/workspace/init.lua +0 -3
  1245. package/payload/tool/luals/script/workspace/loading.lua +0 -228
  1246. package/payload/tool/luals/script/workspace/require-path.lua +0 -317
  1247. package/payload/tool/luals/script/workspace/scope.lua +0 -254
  1248. package/payload/tool/luals/script/workspace/workspace.lua +0 -664
@@ -1,4351 +0,0 @@
1
- ---@meta
2
-
3
- ---@class ngx : table
4
- ---
5
- --- The `ngx.null` constant is a `NULL` light userdata usually used to represent nil values in Lua tables etc and is similar to the `lua-cjson` library's `cjson.null` constant.
6
- ---@field null userdata
7
- ---
8
- --- Read and write the current request's response status. This should be called
9
- --- before sending out the response headers.
10
- ---
11
- --- ```lua
12
- --- -- set
13
- --- ngx.status = ngx.HTTP_CREATED
14
- --- -- get
15
- --- status = ngx.status
16
- --- ```
17
- ---
18
- --- Setting `ngx.status` after the response header is sent out has no effect but leaving an error message in your NGINX's error log file:
19
- --- attempt to set ngx.status after sending out response headers
20
- ---@field status ngx.http.status_code
21
- ---
22
- --- Returns `true` if the response headers have been sent (by ngx_lua), and `false` otherwise.
23
- ---
24
- ---@field headers_sent boolean
25
- ---
26
- --- Returns `true` if the current request is an NGINX subrequest, or `false` otherwise.
27
- ---@field is_subrequest boolean
28
- ---
29
- ngx = {}
30
-
31
- ---@class ngx.OK
32
- ngx.OK = 0
33
- ---@class ngx.ERROR
34
- ngx.ERROR = -1
35
- ngx.AGAIN = -2
36
- ngx.DONE = -4
37
- ngx.DECLINED = -5
38
-
39
- ngx.HTTP_GET = 2
40
- ngx.HTTP_HEAD = 4
41
- ngx.HTTP_POST = 8
42
- ngx.HTTP_PUT = 16
43
- ngx.HTTP_DELETE = 32
44
- ngx.HTTP_MKCOL = 64
45
- ngx.HTTP_COPY = 128
46
- ngx.HTTP_MOVE = 256
47
- ngx.HTTP_OPTIONS = 512
48
- ngx.HTTP_PROPFIND = 1024
49
- ngx.HTTP_PROPPATCH = 2048
50
- ngx.HTTP_LOCK = 4096
51
- ngx.HTTP_UNLOCK = 8192
52
- ngx.HTTP_PATCH = 16384
53
- ngx.HTTP_TRACE = 32768
54
-
55
- ---@alias ngx.http.method
56
- ---| `ngx.HTTP_GET`
57
- ---| `ngx.HTTP_HEAD`
58
- ---| `ngx.HTTP_POST`
59
- ---| `ngx.HTTP_PUT`
60
- ---| `ngx.HTTP_DELETE`
61
- ---| `ngx.HTTP_MKCOL`
62
- ---| `ngx.HTTP_COPY`
63
- ---| `ngx.HTTP_MOVE`
64
- ---| `ngx.HTTP_OPTIONS`
65
- ---| `ngx.HTTP_PROPFIND`
66
- ---| `ngx.HTTP_PROPPATCH`
67
- ---| `ngx.HTTP_LOCK`
68
- ---| `ngx.HTTP_UNLOCK`
69
- ---| `ngx.HTTP_PATCH`
70
- ---| `ngx.HTTP_TRACE`
71
-
72
- ngx.HTTP_CONTINUE = 100
73
- ngx.HTTP_SWITCHING_PROTOCOLS = 101
74
- ngx.HTTP_OK = 200
75
- ngx.HTTP_CREATED = 201
76
- ngx.HTTP_ACCEPTED = 202
77
- ngx.HTTP_NO_CONTENT = 204
78
- ngx.HTTP_PARTIAL_CONTENT = 206
79
- ngx.HTTP_SPECIAL_RESPONSE = 300
80
- ngx.HTTP_MOVED_PERMANENTLY = 301
81
- ngx.HTTP_MOVED_TEMPORARILY = 302
82
- ngx.HTTP_SEE_OTHER = 303
83
- ngx.HTTP_NOT_MODIFIED = 304
84
- ngx.HTTP_TEMPORARY_REDIRECT = 307
85
- ngx.HTTP_PERMANENT_REDIRECT = 308
86
- ngx.HTTP_BAD_REQUEST = 400
87
- ngx.HTTP_UNAUTHORIZED = 401
88
- ngx.HTTP_PAYMENT_REQUIRED = 402
89
- ngx.HTTP_FORBIDDEN = 403
90
- ngx.HTTP_NOT_FOUND = 404
91
- ngx.HTTP_NOT_ALLOWED = 405
92
- ngx.HTTP_NOT_ACCEPTABLE = 406
93
- ngx.HTTP_REQUEST_TIMEOUT = 408
94
- ngx.HTTP_CONFLICT = 409
95
- ngx.HTTP_GONE = 410
96
- ngx.HTTP_UPGRADE_REQUIRED = 426
97
- ngx.HTTP_TOO_MANY_REQUESTS = 429
98
- ngx.HTTP_CLOSE = 444
99
- ngx.HTTP_ILLEGAL = 451
100
- ngx.HTTP_INTERNAL_SERVER_ERROR = 500
101
- ngx.HTTP_METHOD_NOT_IMPLEMENTED = 501
102
- ngx.HTTP_BAD_GATEWAY = 502
103
- ngx.HTTP_SERVICE_UNAVAILABLE = 503
104
- ngx.HTTP_GATEWAY_TIMEOUT = 504
105
- ngx.HTTP_VERSION_NOT_SUPPORTED = 505
106
- ngx.HTTP_INSUFFICIENT_STORAGE = 507
107
-
108
- ---@alias ngx.http.status_code
109
- ---| integer
110
- ---| `ngx.HTTP_CONTINUE`
111
- ---| `ngx.HTTP_SWITCHING_PROTOCOLS`
112
- ---| `ngx.HTTP_OK`
113
- ---| `ngx.HTTP_CREATED`
114
- ---| `ngx.HTTP_ACCEPTED`
115
- ---| `ngx.HTTP_NO_CONTENT`
116
- ---| `ngx.HTTP_PARTIAL_CONTENT`
117
- ---| `ngx.HTTP_SPECIAL_RESPONSE`
118
- ---| `ngx.HTTP_MOVED_PERMANENTLY`
119
- ---| `ngx.HTTP_MOVED_TEMPORARILY`
120
- ---| `ngx.HTTP_SEE_OTHER`
121
- ---| `ngx.HTTP_NOT_MODIFIED`
122
- ---| `ngx.HTTP_TEMPORARY_REDIRECT`
123
- ---| `ngx.HTTP_PERMANENT_REDIRECT`
124
- ---| `ngx.HTTP_BAD_REQUEST`
125
- ---| `ngx.HTTP_UNAUTHORIZED`
126
- ---| `ngx.HTTP_PAYMENT_REQUIRED`
127
- ---| `ngx.HTTP_FORBIDDEN`
128
- ---| `ngx.HTTP_NOT_FOUND`
129
- ---| `ngx.HTTP_NOT_ALLOWED`
130
- ---| `ngx.HTTP_NOT_ACCEPTABLE`
131
- ---| `ngx.HTTP_REQUEST_TIMEOUT`
132
- ---| `ngx.HTTP_CONFLICT`
133
- ---| `ngx.HTTP_GONE`
134
- ---| `ngx.HTTP_UPGRADE_REQUIRED`
135
- ---| `ngx.HTTP_TOO_MANY_REQUESTS`
136
- ---| `ngx.HTTP_CLOSE`
137
- ---| `ngx.HTTP_ILLEGAL`
138
- ---| `ngx.HTTP_INTERNAL_SERVER_ERROR`
139
- ---| `ngx.HTTP_METHOD_NOT_IMPLEMENTED`
140
- ---| `ngx.HTTP_BAD_GATEWAY`
141
- ---| `ngx.HTTP_SERVICE_UNAVAILABLE`
142
- ---| `ngx.HTTP_GATEWAY_TIMEOUT`
143
- ---| `ngx.HTTP_VERSION_NOT_SUPPORTED`
144
- ---| `ngx.HTTP_INSUFFICIENT_STORAGE`
145
-
146
- ngx.DEBUG = 8
147
- ngx.INFO = 7
148
- ngx.NOTICE = 6
149
- ngx.WARN = 5
150
- ngx.ERR = 4
151
- ngx.CRIT = 3
152
- ngx.ALERT = 2
153
- ngx.EMERG = 1
154
- ngx.STDERR = 0
155
-
156
- --- NGINX log level constants
157
- --- https://github.com/openresty/lua-nginx-module/#nginx-log-level-constants
158
- ---@alias ngx.log.level
159
- ---| `ngx.DEBUG` # debug
160
- ---| `ngx.INFO` # info
161
- ---| `ngx.NOTICE` # notice
162
- ---| `ngx.WARN` # warning
163
- ---| `ngx.ERR` # error
164
- ---| `ngx.ALERT` # alert
165
- ---| `ngx.CRIT` # critical
166
- ---| `ngx.EMERG` # emergency
167
- ---| `ngx.STDERR` # standard error
168
-
169
- --- ngx.ctx table
170
- ---
171
- --- This table can be used to store per-request Lua context data and has a life time identical to the current request (as with the NGINX variables).
172
- ---
173
- --- Consider the following example,
174
- ---
175
- --- ```nginx
176
- --- location /test {
177
- --- rewrite_by_lua_block {
178
- --- ngx.ctx.foo = 76
179
- --- }
180
- --- access_by_lua_block {
181
- --- ngx.ctx.foo = ngx.ctx.foo + 3
182
- --- }
183
- --- content_by_lua_block {
184
- --- ngx.say(ngx.ctx.foo)
185
- --- }
186
- --- }
187
- --- ```
188
- ---
189
- --- Then `GET /test` will yield the output
190
- ---
191
- --- ```bash
192
- --- 79
193
- --- ```
194
- ---
195
- --- That is, the `ngx.ctx.foo` entry persists across the rewrite, access, and content phases of a request.
196
- ---
197
- --- Every request, including subrequests, has its own copy of the table. For example:
198
- ---
199
- --- ```nginx
200
- --- location /sub {
201
- --- content_by_lua_block {
202
- --- ngx.say("sub pre: ", ngx.ctx.blah)
203
- --- ngx.ctx.blah = 32
204
- --- ngx.say("sub post: ", ngx.ctx.blah)
205
- --- }
206
- --- }
207
- ---
208
- --- location /main {
209
- --- content_by_lua_block {
210
- --- ngx.ctx.blah = 73
211
- --- ngx.say("main pre: ", ngx.ctx.blah)
212
- --- local res = ngx.location.capture("/sub")
213
- --- ngx.print(res.body)
214
- --- ngx.say("main post: ", ngx.ctx.blah)
215
- --- }
216
- --- }
217
- --- ```
218
- ---
219
- --- Then `GET /main` will give the output
220
- ---
221
- --- ```bash
222
- --- main pre: 73
223
- --- sub pre: nil
224
- --- sub post: 32
225
- --- main post: 73
226
- --- ```
227
- ---
228
- --- Here, modification of the `ngx.ctx.blah` entry in the subrequest does not affect the one in the parent request. This is because they have two separate versions of `ngx.ctx.blah`.
229
- ---
230
- --- Internal redirection will destroy the original request `ngx.ctx` data (if any) and the new request will have an empty `ngx.ctx` table. For instance,
231
- ---
232
- --- ```nginx
233
- --- location /new {
234
- --- content_by_lua_block {
235
- --- ngx.say(ngx.ctx.foo)
236
- --- }
237
- --- }
238
- ---
239
- --- location /orig {
240
- --- content_by_lua_block {
241
- --- ngx.ctx.foo = "hello"
242
- --- ngx.exec("/new")
243
- --- }
244
- --- }
245
- --- ```
246
- ---
247
- --- Then `GET /orig` will give
248
- ---
249
- --- ```bash
250
- --- nil
251
- --- ```
252
- ---
253
- --- rather than the original `"hello"` value.
254
- ---
255
- --- Arbitrary data values, including Lua closures and nested tables, can be inserted into this "magic" table. It also allows the registration of custom meta methods.
256
- ---
257
- --- Overriding `ngx.ctx` with a new Lua table is also supported, for example,
258
- ---
259
- --- ```lua
260
- --- ngx.ctx = { foo = 32, bar = 54 }
261
- --- ```
262
- ---
263
- --- When being used in the context of `init_worker_by_lua*`, this table just has the same lifetime of the current Lua handler.
264
- ---
265
- --- The `ngx.ctx` lookup requires relatively expensive metamethod calls and it is much slower than explicitly passing per-request data along by your own function arguments. So do not abuse this API for saving your own function arguments because it usually has quite some performance impact.
266
- ---
267
- --- Because of the metamethod magic, never "local" the `ngx.ctx` table outside your Lua function scope on the Lua module level due to `worker-level data sharing`. For example, the following is bad:
268
- ---
269
- --- ```lua
270
- --- -- mymodule.lua
271
- --- local _M = {}
272
- ---
273
- --- -- the following line is bad since ngx.ctx is a per-request
274
- --- -- data while this <code>ctx</code> variable is on the Lua module level
275
- --- -- and thus is per-nginx-worker.
276
- --- local ctx = ngx.ctx
277
- ---
278
- --- function _M.main()
279
- --- ctx.foo = "bar"
280
- --- end
281
- ---
282
- --- return _M
283
- --- ```
284
- ---
285
- --- Use the following instead:
286
- ---
287
- --- ```lua
288
- --- -- mymodule.lua
289
- --- local _M = {}
290
- ---
291
- --- function _M.main(ctx)
292
- --- ctx.foo = "bar"
293
- --- end
294
- ---
295
- --- return _M
296
- --- ```
297
- ---
298
- --- That is, let the caller pass the `ctx` table explicitly via a function argument.
299
- ngx.ctx = {}
300
-
301
- --- NGINX thread methods
302
- ngx.thread = {}
303
-
304
- ---@class ngx.thread : thread
305
-
306
- --- Kills a running "light thread" created by `ngx.thread.spawn`. Returns a true value when successful or `nil` and a string describing the error otherwise.
307
- ---
308
- --- According to the current implementation, only the parent coroutine (or "light thread") can kill a thread. Also, a running "light thread" with pending NGINX subrequests (initiated by `ngx.location.capture` for example) cannot be killed due to a limitation in the NGINX core.
309
- ---
310
- ---@param thread ngx.thread
311
- ---@return boolean ok
312
- ---@return string? error
313
- function ngx.thread.kill(thread) end
314
-
315
- --- Waits on one or more child "light threads" and returns the results of the first "light thread" that terminates (either successfully or with an error).
316
- ---
317
- --- The arguments `thread1`, `thread2`, and etc are the Lua thread objects returned by earlier calls of `ngx.thread.spawn`.
318
- ---
319
- --- The return values have exactly the same meaning as `coroutine.resume`, that is, the first value returned is a boolean value indicating whether the "light thread" terminates successfully or not, and subsequent values returned are the return values of the user Lua function that was used to spawn the "light thread" (in case of success) or the error object (in case of failure).
320
- ---
321
- --- Only the direct "parent coroutine" can wait on its child "light thread", otherwise a Lua exception will be raised.
322
- ---
323
- --- The following example demonstrates the use of `ngx.thread.wait` and `ngx.location.capture` to emulate `ngx.location.capture_multi`:
324
- ---
325
- --- ```lua
326
- --- local capture = ngx.location.capture
327
- --- local spawn = ngx.thread.spawn
328
- --- local wait = ngx.thread.wait
329
- --- local say = ngx.say
330
- ---
331
- --- local function fetch(uri)
332
- --- return capture(uri)
333
- --- end
334
- ---
335
- --- local threads = {
336
- --- spawn(fetch, "/foo"),
337
- --- spawn(fetch, "/bar"),
338
- --- spawn(fetch, "/baz")
339
- --- }
340
- ---
341
- --- for i = 1, #threads do
342
- --- local ok, res = wait(threads[i])
343
- --- if not ok then
344
- --- say(i, ": failed to run: ", res)
345
- --- else
346
- --- say(i, ": status: ", res.status)
347
- --- say(i, ": body: ", res.body)
348
- --- end
349
- --- end
350
- --- ```
351
- ---
352
- --- Here it essentially implements the "wait all" model.
353
- ---
354
- --- And below is an example demonstrating the "wait any" model:
355
- ---
356
- --- ```lua
357
- --- function f()
358
- --- ngx.sleep(0.2)
359
- --- ngx.say("f: hello")
360
- --- return "f done"
361
- --- end
362
- ---
363
- --- function g()
364
- --- ngx.sleep(0.1)
365
- --- ngx.say("g: hello")
366
- --- return "g done"
367
- --- end
368
- ---
369
- --- local tf, err = ngx.thread.spawn(f)
370
- --- if not tf then
371
- --- ngx.say("failed to spawn thread f: ", err)
372
- --- return
373
- --- end
374
- ---
375
- --- ngx.say("f thread created: ", coroutine.status(tf))
376
- ---
377
- --- local tg, err = ngx.thread.spawn(g)
378
- --- if not tg then
379
- --- ngx.say("failed to spawn thread g: ", err)
380
- --- return
381
- --- end
382
- ---
383
- --- ngx.say("g thread created: ", coroutine.status(tg))
384
- ---
385
- --- ok, res = ngx.thread.wait(tf, tg)
386
- --- if not ok then
387
- --- ngx.say("failed to wait: ", res)
388
- --- return
389
- --- end
390
- ---
391
- --- ngx.say("res: ", res)
392
- ---
393
- --- -- stop the "world", aborting other running threads
394
- --- ngx.exit(ngx.OK)
395
- --- ```
396
- ---
397
- --- And it will generate the following output:
398
- ---
399
- --- f thread created: running
400
- --- g thread created: running
401
- --- g: hello
402
- --- res: g done
403
- ---
404
- ---@param ... ngx.thread
405
- ---@return boolean ok
406
- ---@return any ret_or_error
407
- function ngx.thread.wait(...) end
408
-
409
- --- Spawns a new user "light thread" with the Lua function `func` as well as those optional arguments `arg1`, `arg2`, and etc. Returns a Lua thread (or Lua coroutine) object represents this "light thread".
410
- ---
411
- --- "Light threads" are just a special kind of Lua coroutines that are scheduled by the ngx_lua module.
412
- ---
413
- --- Before `ngx.thread.spawn` returns, the `func` will be called with those optional arguments until it returns, aborts with an error, or gets yielded due to I/O operations via the NGINX APIs for lua (like `tcpsock:receive`).
414
- ---
415
- --- After `ngx.thread.spawn` returns, the newly-created "light thread" will keep running asynchronously usually at various I/O events.
416
- ---
417
- --- All the Lua code chunks running by `rewrite_by_lua`, `access_by_lua`, and `content_by_lua` are in a boilerplate "light thread" created automatically by ngx_lua. Such boilerplate "light thread" are also called "entry threads".
418
- ---
419
- --- By default, the corresponding NGINX handler (e.g., `rewrite_by_lua` handler) will not terminate until
420
- ---
421
- --- 1. both the "entry thread" and all the user "light threads" terminates,
422
- --- 1. a "light thread" (either the "entry thread" or a user "light thread" aborts by calling `ngx.exit`, `ngx.exec`, `ngx.redirect`, or `ngx.req.set_uri(uri, true)`, or
423
- --- 1. the "entry thread" terminates with a Lua error.
424
- ---
425
- --- When the user "light thread" terminates with a Lua error, however, it will not abort other running "light threads" like the "entry thread" does.
426
- ---
427
- --- Due to the limitation in the NGINX subrequest model, it is not allowed to abort a running NGINX subrequest in general. So it is also prohibited to abort a running "light thread" that is pending on one ore more NGINX subrequests. You must call `ngx.thread.wait` to wait for those "light thread" to terminate before quitting the "world". A notable exception here is that you can abort pending subrequests by calling `ngx.exit` with and only with the status code `ngx.ERROR` (-1), `408`, `444`, or `499`.
428
- ---
429
- --- The "light threads" are not scheduled in a pre-emptive way. In other words, no time-slicing is performed automatically. A "light thread" will keep running exclusively on the CPU until
430
- ---
431
- --- 1. a (nonblocking) I/O operation cannot be completed in a single run,
432
- --- 1. it calls `coroutine.yield` to actively give up execution, or
433
- --- 1. it is aborted by a Lua error or an invocation of `ngx.exit`, `ngx.exec`, `ngx.redirect`, or `ngx.req.set_uri(uri, true)`.
434
- ---
435
- --- For the first two cases, the "light thread" will usually be resumed later by the ngx_lua scheduler unless a "stop-the-world" event happens.
436
- ---
437
- --- User "light threads" can create "light threads" themselves. And normal user coroutines created by `coroutine.create` can also create "light threads". The coroutine (be it a normal Lua coroutine or a "light thread") that directly spawns the "light thread" is called the "parent coroutine" for the "light thread" newly spawned.
438
- ---
439
- --- The "parent coroutine" can call `ngx.thread.wait` to wait on the termination of its child "light thread".
440
- ---
441
- --- You can call coroutine.status() and coroutine.yield() on the "light thread" coroutines.
442
- ---
443
- --- The status of the "light thread" coroutine can be "zombie" if
444
- ---
445
- --- 1. the current "light thread" already terminates (either successfully or with an error),
446
- --- 1. its parent coroutine is still alive, and
447
- --- 1. its parent coroutine is not waiting on it with `ngx.thread.wait`.
448
- ---
449
- --- The following example demonstrates the use of coroutine.yield() in the "light thread" coroutines
450
- --- to do manual time-slicing:
451
- ---
452
- --- ```lua
453
- --- local yield = coroutine.yield
454
- ---
455
- --- function f()
456
- --- local self = coroutine.running()
457
- --- ngx.say("f 1")
458
- --- yield(self)
459
- --- ngx.say("f 2")
460
- --- yield(self)
461
- --- ngx.say("f 3")
462
- --- end
463
- ---
464
- --- local self = coroutine.running()
465
- --- ngx.say("0")
466
- --- yield(self)
467
- ---
468
- --- ngx.say("1")
469
- --- ngx.thread.spawn(f)
470
- ---
471
- --- ngx.say("2")
472
- --- yield(self)
473
- ---
474
- --- ngx.say("3")
475
- --- yield(self)
476
- ---
477
- --- ngx.say("4")
478
- --- ```
479
- ---
480
- --- Then it will generate the output
481
- ---
482
- --- 0
483
- --- 1
484
- --- f 1
485
- --- 2
486
- --- f 2
487
- --- 3
488
- --- f 3
489
- --- 4
490
- ---
491
- --- "Light threads" are mostly useful for making concurrent upstream requests in a single NGINX request handler, much like a generalized version of `ngx.location.capture_multi` that can work with all the NGINX APIs for lua. The following example demonstrates parallel requests to MySQL, Memcached, and upstream HTTP services in a single Lua handler, and outputting the results in the order that they actually return (similar to Facebook's BigPipe model):
492
- ---
493
- --- ```lua
494
- --- -- query mysql, memcached, and a remote http service at the same time,
495
- --- -- output the results in the order that they
496
- --- -- actually return the results.
497
- ---
498
- --- local mysql = require "resty.mysql"
499
- --- local memcached = require "resty.memcached"
500
- ---
501
- --- local function query_mysql()
502
- --- local db = mysql:new()
503
- --- db:connect{
504
- --- host = "127.0.0.1",
505
- --- port = 3306,
506
- --- database = "test",
507
- --- user = "monty",
508
- --- password = "mypass"
509
- --- }
510
- --- local res, err, errno, sqlstate =
511
- --- db:query("select * from cats order by id asc")
512
- --- db:set_keepalive(0, 100)
513
- --- ngx.say("mysql done: ", cjson.encode(res))
514
- --- end
515
- ---
516
- --- local function query_memcached()
517
- --- local memc = memcached:new()
518
- --- memc:connect("127.0.0.1", 11211)
519
- --- local res, err = memc:get("some_key")
520
- --- ngx.say("memcached done: ", res)
521
- --- end
522
- ---
523
- --- local function query_http()
524
- --- local res = ngx.location.capture("/my-http-proxy")
525
- --- ngx.say("http done: ", res.body)
526
- --- end
527
- ---
528
- --- ngx.thread.spawn(query_mysql) -- create thread 1
529
- --- ngx.thread.spawn(query_memcached) -- create thread 2
530
- --- ngx.thread.spawn(query_http) -- create thread 3
531
- --- ```
532
- ---
533
- ---@param func function
534
- ---@param ... any
535
- ---@return ngx.thread
536
- function ngx.thread.spawn(func, ...) end
537
-
538
- --- NGINX worker methods
539
- ngx.worker = {}
540
-
541
- --- This function returns a boolean value indicating whether the current NGINX worker process already starts exiting. NGINX worker process exiting happens on NGINX server quit or configuration reload (aka HUP reload).
542
- ---
543
- ---@return boolean
544
- function ngx.worker.exiting() end
545
-
546
- --- Returns the ordinal number of the current NGINX worker processes (starting from number 0).
547
- ---
548
- --- So if the total number of workers is `N`, then this method may return a number between 0
549
- --- and `N - 1` (inclusive).
550
- ---
551
- ---@return number
552
- function ngx.worker.id() end
553
-
554
- --- Returns the total number of the NGINX worker processes (i.e., the value configured
555
- --- by the `worker_processes`
556
- --- directive in `nginx.conf`).
557
- ---
558
- ---@return number
559
- function ngx.worker.count() end
560
-
561
- --- This function returns a Lua number for the process ID (PID) of the current NGINX worker process. This API is more efficient than `ngx.var.pid` and can be used in contexts where the `ngx.var.VARIABLE` API cannot be used (like `init_worker_by_lua`).
562
- ---
563
- ---@return number
564
- function ngx.worker.pid() end
565
-
566
- ---@class ngx.config : table
567
- ---
568
- --- This string field indicates the current NGINX subsystem the current Lua environment is based on. For this module, this field always takes the string value `"http"`.
569
- --- For `ngx_stream_lua_module`, however, this field takes the value `"stream"`.
570
- ---@field subsystem '"http"'|'"stream"'
571
- ---
572
- --- This field takes an integral value indicating the version number of the current NGINX core being used. For example, the version number `1.4.3` results in the Lua number 1004003.
573
- ---@field nginx_version number
574
- ---
575
- --- This field takes an integral value indicating the version number of the current `ngx_lua` module being used.
576
- --- For example, the version number `0.9.3` results in the Lua number 9003.
577
- ---@field ngx_lua_version number
578
- ---
579
- --- This boolean field indicates whether the current NGINX is a debug build, i.e., being built by the `./configure` option `--with-debug`.
580
- ---@field debug boolean
581
- ---
582
- --- This boolean field indicates whether the current NGINX run by resty.
583
- ---@field is_console boolean
584
- ---
585
- ngx.config = {}
586
-
587
- --- Returns the NGINX server "prefix" path, as determined by the `-p` command-line option when running the NGINX executable, or the path specified by the `--prefix` command-line option when building NGINX with the `./configure` script.
588
- ---
589
- ---@return string
590
- function ngx.config.prefix() end
591
-
592
- --- This function returns a string for the NGINX `./configure` command's arguments string.
593
- ---
594
- ---@return string
595
- function ngx.config.nginx_configure() end
596
-
597
- ngx.timer = {}
598
-
599
- ---@alias ngx.timer.callback fun(premature:boolean, ...:any)
600
-
601
- --- Returns the number of pending timers.
602
- ---
603
- ---@return number
604
- function ngx.timer.pending_count() end
605
-
606
- --- Returns the number of timers currently running.
607
- ---
608
- ---@return integer
609
- function ngx.timer.running_count() end
610
-
611
- --- Similar to the `ngx.timer.at` API function, but
612
- ---
613
- --- 1. `delay` *cannot* be zero,
614
- --- 2. timer will be created every `delay` seconds until the current NGINX worker process starts exiting.
615
- ---
616
- --- When success, returns a "conditional true" value (but not a `true`). Otherwise, returns a "conditional false" value and a string describing the error.
617
- ---
618
- --- This API also respect the `lua_max_pending_timers` and `lua_max_running_timers`.
619
- ---
620
- ---@param delay number the interval to execute the timer on
621
- ---@param callback ngx.timer.callback the function to call
622
- ---@param ... any extra arguments to pass to `callback`
623
- ---@return boolean ok
624
- ---@return string? error
625
- function ngx.timer.every(delay, callback, ...) end
626
-
627
- --- Creates an NGINX timer with a user callback function as well as optional user arguments.
628
- ---
629
- --- The first argument, `delay`, specifies the delay for the timer,
630
- --- in seconds. One can specify fractional seconds like `0.001` to mean 1
631
- --- millisecond here. `0` delay can also be specified, in which case the
632
- --- timer will immediately expire when the current handler yields
633
- --- execution.
634
- ---
635
- --- The second argument, `callback`, can
636
- --- be any Lua function, which will be invoked later in a background
637
- --- "light thread" after the delay specified. The user callback will be
638
- --- called automatically by the NGINX core with the arguments `premature`,
639
- --- `user_arg1`, `user_arg2`, and etc, where the `premature`
640
- --- argument takes a boolean value indicating whether it is a premature timer
641
- --- expiration or not, and `user_arg1`, `user_arg2`, and etc, are
642
- --- those (extra) user arguments specified when calling `ngx.timer.at`
643
- --- as the remaining arguments.
644
- ---
645
- --- Premature timer expiration happens when the NGINX worker process is
646
- --- trying to shut down, as in an NGINX configuration reload triggered by
647
- --- the `HUP` signal or in an NGINX server shutdown. When the NGINX worker
648
- --- is trying to shut down, one can no longer call `ngx.timer.at` to
649
- --- create new timers with nonzero delays and in that case `ngx.timer.at` will return a "conditional false" value and
650
- --- a string describing the error, that is, "process exiting".
651
- ---
652
- --- It is allowed to create zero-delay timers even when the NGINX worker process starts shutting down.
653
- ---
654
- --- When a timer expires, the user Lua code in the timer callback is
655
- --- running in a "light thread" detached completely from the original
656
- --- request creating the timer. So objects with the same lifetime as the
657
- --- request creating them, like `cosockets`, cannot be shared between the
658
- --- original request and the timer user callback function.
659
- ---
660
- --- Here is a simple example:
661
- ---
662
- --- ```nginx
663
- --- location / {
664
- --- ...
665
- --- log_by_lua_block {
666
- --- local function push_data(premature, uri, args, status)
667
- --- -- push the data uri, args, and status to the remote
668
- --- -- via ngx.socket.tcp or ngx.socket.udp
669
- --- -- (one may want to buffer the data in Lua a bit to
670
- --- -- save I/O operations)
671
- --- end
672
- --- local ok, err = ngx.timer.at(0, push_data,
673
- --- ngx.var.uri, ngx.var.args, ngx.header.status)
674
- --- if not ok then
675
- --- ngx.log(ngx.ERR, "failed to create timer: ", err)
676
- --- return
677
- --- end
678
- --- }
679
- --- }
680
- --- ```
681
- ---
682
- --- One can also create infinite re-occurring timers, for instance, a timer getting triggered every `5` seconds, by calling `ngx.timer.at` recursively in the timer callback function. Here is such an example,
683
- ---
684
- --- ```lua
685
- --- local delay = 5
686
- --- local handler
687
- --- handler = function (premature)
688
- --- -- do some routine job in Lua just like a cron job
689
- --- if premature then
690
- --- return
691
- --- end
692
- --- local ok, err = ngx.timer.at(delay, handler)
693
- --- if not ok then
694
- --- ngx.log(ngx.ERR, "failed to create the timer: ", err)
695
- --- return
696
- --- end
697
- --- end
698
- ---
699
- --- local ok, err = ngx.timer.at(delay, handler)
700
- --- if not ok then
701
- --- ngx.log(ngx.ERR, "failed to create the timer: ", err)
702
- --- return
703
- --- end
704
- --- ```
705
- ---
706
- --- It is recommended, however, to use the `ngx.timer.every` API function
707
- --- instead for creating recurring timers since it is more robust.
708
- ---
709
- --- Because timer callbacks run in the background and their running time
710
- --- will not add to any client request's response time, they can easily
711
- --- accumulate in the server and exhaust system resources due to either
712
- --- Lua programming mistakes or just too much client traffic. To prevent
713
- --- extreme consequences like crashing the NGINX server, there are
714
- --- built-in limitations on both the number of "pending timers" and the
715
- --- number of "running timers" in an NGINX worker process. The "pending
716
- --- timers" here mean timers that have not yet been expired and "running
717
- --- timers" are those whose user callbacks are currently running.
718
- ---
719
- --- The maximal number of pending timers allowed in an NGINX
720
- --- worker is controlled by the `lua_max_pending_timers`
721
- --- directive. The maximal number of running timers is controlled by the
722
- --- `lua_max_running_timers` directive.
723
- ---
724
- --- According to the current implementation, each "running timer" will
725
- --- take one (fake) connection record from the global connection record
726
- --- list configured by the standard `worker_connections` directive in
727
- --- `nginx.conf`. So ensure that the
728
- --- `worker_connections` directive is set to
729
- --- a large enough value that takes into account both the real connections
730
- --- and fake connections required by timer callbacks (as limited by the
731
- --- `lua_max_running_timers` directive).
732
- ---
733
- --- A lot of the Lua APIs for NGINX are enabled in the context of the timer
734
- --- callbacks, like stream/datagram cosockets (`ngx.socket.tcp` and `ngx.socket.udp`), shared
735
- --- memory dictionaries (`ngx.shared.DICT`), user coroutines (`coroutine.*`),
736
- --- user "light threads" (`ngx.thread.*`), `ngx.exit`, `ngx.now`/`ngx.time`,
737
- --- `ngx.md5`/`ngx.sha1_bin`, are all allowed. But the subrequest API (like
738
- --- `ngx.location.capture`), the `ngx.req.*` API, the downstream output API
739
- --- (like `ngx.say`, `ngx.print`, and `ngx.flush`) are explicitly disabled in
740
- --- this context.
741
- ---
742
- --- You can pass most of the standard Lua values (nils, booleans, numbers, strings, tables, closures, file handles, and etc) into the timer callback, either explicitly as user arguments or implicitly as upvalues for the callback closure. There are several exceptions, however: you *cannot* pass any thread objects returned by `coroutine.create` and `ngx.thread.spawn` or any cosocket objects returned by `ngx.socket.tcp`, `ngx.socket.udp`, and `ngx.req.socket` because these objects' lifetime is bound to the request context creating them while the timer callback is detached from the creating request's context (by design) and runs in its own (fake) request context. If you try to share the thread or cosocket objects across the boundary of the creating request, then you will get the "no co ctx found" error (for threads) or "bad request" (for cosockets). It is fine, however, to create all these objects inside your timer callback.
743
- ---
744
- ---@param delay number
745
- ---@param callback ngx.timer.callback
746
- ---@param ... any
747
- ---@return boolean ok
748
- ---@return string? error
749
- function ngx.timer.at(delay, callback, ...) end
750
-
751
- --- Unescape `str` as an escaped URI component.
752
- ---
753
- --- For example,
754
- ---
755
- --- ```lua
756
- --- ngx.say(ngx.unescape_uri("b%20r56+7"))
757
- --- ```
758
- ---
759
- --- gives the output
760
- ---
761
- --- b r56 7
762
- ---
763
- ---@param str string
764
- ---@return string
765
- function ngx.unescape_uri(str) end
766
-
767
- --- Escape `str` as a URI component.
768
- ---
769
- ---@param str string
770
- ---@return string
771
- function ngx.escape_uri(str) end
772
-
773
- --- Returns the binary form of the SHA-1 digest of the `str` argument.
774
- ---
775
- --- This function requires SHA-1 support in the NGINX build. (This usually just means OpenSSL should be installed while building NGINX).
776
- ---
777
- ---@param str string
778
- ---@return any
779
- function ngx.sha1_bin(str) end
780
-
781
- --- Calculates the CRC-32 (Cyclic Redundancy Code) digest for the `str` argument.
782
- ---
783
- --- This method performs better on relatively short `str` inputs (i.e., less than 30 ~ 60 bytes), as compared to `ngx.crc32_long`. The result is exactly the same as `ngx.crc32_long`.
784
- ---
785
- --- Behind the scene, it is just a thin wrapper around the `ngx_crc32_short` function defined in the NGINX core.
786
- ---
787
- ---@param str string
788
- ---@return number
789
- function ngx.crc32_short(str) end
790
-
791
- --- Calculates the CRC-32 (Cyclic Redundancy Code) digest for the `str` argument.
792
- ---
793
- --- This method performs better on relatively long `str` inputs (i.e., longer than 30 ~ 60 bytes), as compared to `ngx.crc32_short`. The result is exactly the same as `ngx.crc32_short`.
794
- ---
795
- --- Behind the scene, it is just a thin wrapper around the `ngx_crc32_long` function defined in the NGINX core.
796
- ---
797
- ---@param str string
798
- ---@return number
799
- function ngx.crc32_long(str) end
800
-
801
- --- Returns the binary form of the MD5 digest of the `str` argument.
802
- ---
803
- --- See `ngx.md5` if the hexadecimal form of the MD5 digest is required.
804
- ---
805
- ---@param str string
806
- ---@return string
807
- function ngx.md5_bin(str) end
808
-
809
- --- Returns the hexadecimal representation of the MD5 digest of the `str` argument.
810
- ---
811
- --- For example,
812
- ---
813
- --- ```nginx
814
- --- location = /md5 {
815
- --- content_by_lua_block { ngx.say(ngx.md5("hello")) }
816
- --- }
817
- --- ```
818
- ---
819
- --- yields the output
820
- ---
821
- --- 5d41402abc4b2a76b9719d911017c592
822
- ---
823
- --- See `ngx.md5_bin` if the raw binary MD5 digest is required.
824
- ---
825
- ---@param str string
826
- ---@return string
827
- function ngx.md5(str) end
828
-
829
- --- Computes the `HMAC-SHA1` digest of the argument `str` and turns the result using the secret key `<secret_key>`.
830
- ---
831
- --- The raw binary form of the `HMAC-SHA1` digest will be generated, use `ngx.encode_base64`, for example, to encode the result to a textual representation if desired.
832
- ---
833
- --- For example,
834
- ---
835
- --- ```lua
836
- --- local key = "thisisverysecretstuff"
837
- --- local src = "some string we want to sign"
838
- --- local digest = ngx.hmac_sha1(key, src)
839
- --- ngx.say(ngx.encode_base64(digest))
840
- --- ```
841
- ---
842
- --- yields the output
843
- ---
844
- --- R/pvxzHC4NLtj7S+kXFg/NePTmk=
845
- ---
846
- ---@param secret_key string
847
- ---@param str string
848
- ---@return string
849
- function ngx.hmac_sha1(secret_key, str) end
850
-
851
- --- Returns a quoted SQL string literal according to the MySQL quoting rules.
852
- ---
853
- ---@param raw_value string
854
- ---@return string
855
- function ngx.quote_sql_str(raw_value) end
856
-
857
- ngx.re = {}
858
-
859
- --- PCRE regex options string
860
- ---
861
- --- This is a string made up of single-letter PCRE option names, usable in all `ngx.re.*` functions.
862
- ---
863
- --- Options:
864
- ---
865
- --- a - anchored mode (only match from the beginning)
866
- --- d - enable the DFA mode (or the longest token match semantics).
867
- --- D - enable duplicate named pattern support. This allows named subpattern names to be repeated, returning the captures in an array-like Lua table.
868
- --- i - case insensitive mode
869
- --- j - enable PCRE JIT compilation. For optimum performance, this option should always be used together with the 'o' option.
870
- --- J - enable the PCRE Javascript compatible mode
871
- --- m - multi-line mode
872
- --- o - compile-once mode, to enable the worker-process-level compiled-regex cache
873
- --- s - single-line mode
874
- --- u - UTF-8 mode.
875
- --- U - similar to "u" but disables PCRE's UTF-8 validity check on the subject string
876
- --- x - extended mode
877
- ---
878
- --- These options can be combined:
879
- ---
880
- --- ```lua
881
- --- local m, err = ngx.re.match("hello, world", "HEL LO", "ix")
882
- --- -- m[0] == "hello"
883
- --- ```
884
- ---
885
- --- ```lua
886
- --- local m, err = ngx.re.match("hello, 美好生活", "HELLO, (.{2})", "iu")
887
- --- -- m[0] == "hello, 美好"
888
- --- -- m[1] == "美好"
889
- --- ```
890
- ---
891
- --- The `o` option is useful for performance tuning, because the regex pattern in question will only be compiled once, cached in the worker-process level, and shared among all requests in the current NGINX worker process. The upper limit of the regex cache can be tuned via the `lua_regex_cache_max_entries` directive.
892
- ---
893
- ---@alias ngx.re.options string
894
-
895
- --- ngx.re.match capture table
896
- ---
897
- --- This table may have both integer and string keys.
898
- ---
899
- --- `captures[0]` is special and contains the whole substring match
900
- ---
901
- --- `captures[1]` through `captures[n]` contain the values of unnamed, parenthesized sub-pattern captures
902
- ---
903
- --- ```lua
904
- --- local m, err = ngx.re.match("hello, 1234", "[0-9]+")
905
- --- if m then
906
- --- -- m[0] == "1234"
907
- ---
908
- --- else
909
- --- if err then
910
- --- ngx.log(ngx.ERR, "error: ", err)
911
- --- return
912
- --- end
913
- ---
914
- --- ngx.say("match not found")
915
- --- end
916
- --- ```
917
- ---
918
- --- ```lua
919
- --- local m, err = ngx.re.match("hello, 1234", "([0-9])[0-9]+")
920
- --- -- m[0] == "1234"
921
- --- -- m[1] == "1"
922
- --- ```
923
- ---
924
- --- Named captures are stored with string keys corresponding to the capture name (e.g. `captures["my_capture_name"]`) _in addition to_ their sequential integer key (`captures[n]`):
925
- ---
926
- --- ```lua
927
- --- local m, err = ngx.re.match("hello, 1234", "([0-9])(?<remaining>[0-9]+)")
928
- --- -- m[0] == "1234"
929
- --- -- m[1] == "1"
930
- --- -- m[2] == "234"
931
- --- -- m["remaining"] == "234"
932
- --- ```
933
- ---
934
- --- Unmatched captures (named or unnamed) take the value `false`.
935
- ---
936
- --- ```lua
937
- --- local m, err = ngx.re.match("hello, world", "(world)|(hello)|(?<named>howdy)")
938
- --- -- m[0] == "hello"
939
- --- -- m[1] == false
940
- --- -- m[2] == "hello"
941
- --- -- m[3] == false
942
- --- -- m["named"] == false
943
- --- ```
944
- ---
945
- ---@alias ngx.re.captures table<integer|string, string|string[]|'false'>
946
-
947
- --- ngx.re.match context table
948
- ---
949
- --- A Lua table holding an optional `pos` field. When the `pos` field in the `ctx` table argument is specified, `ngx.re.match` will start matching from that offset (starting from 1). Regardless of the presence of the `pos` field in the `ctx` table, `ngx.re.match` will always set this `pos` field to the position *after* the substring matched by the whole pattern in case of a successful match. When match fails, the `ctx` table will be left intact.
950
- ---
951
- --- ```lua
952
- --- local ctx = {}
953
- --- local m, err = ngx.re.match("1234, hello", "[0-9]+", "", ctx)
954
- --- -- m[0] = "1234"
955
- --- -- ctx.pos == 5
956
- --- ```
957
- ---
958
- --- ```lua
959
- --- local ctx = { pos = 2 }
960
- --- local m, err = ngx.re.match("1234, hello", "[0-9]+", "", ctx)
961
- --- -- m[0] = "234"
962
- --- -- ctx.pos == 5
963
- --- ```
964
- ---
965
- ---@class ngx.re.ctx : table
966
- ---@field pos? integer
967
-
968
- --- Similar to `ngx.re.match` but only returns the beginning index (`from`) and end index (`to`) of the matched substring. The returned indexes are 1-based and can be fed directly into the `string.sub` API function to obtain the matched substring.
969
- ---
970
- --- In case of errors (like bad regexes or any PCRE runtime errors), this API function returns two `nil` values followed by a string describing the error.
971
- ---
972
- --- If no match is found, this function just returns a `nil` value.
973
- ---
974
- --- Below is an example:
975
- ---
976
- --- ```lua
977
- --- local s = "hello, 1234"
978
- --- local from, to, err = ngx.re.find(s, "([0-9]+)", "jo")
979
- --- if from then
980
- --- ngx.say("from: ", from)
981
- --- ngx.say("to: ", to)
982
- --- ngx.say("matched: ", string.sub(s, from, to))
983
- --- else
984
- --- if err then
985
- --- ngx.say("error: ", err)
986
- --- return
987
- --- end
988
- --- ngx.say("not matched!")
989
- --- end
990
- --- ```
991
- ---
992
- --- This example produces the output
993
- ---
994
- --- from: 8
995
- --- to: 11
996
- --- matched: 1234
997
- ---
998
- --- Because this API function does not create new Lua strings nor new Lua tables, it is much faster than `ngx.re.match`. It should be used wherever possible.
999
- ---
1000
- --- The optional 5th argument, `nth`, allows the caller to specify which (submatch) capture's indexes to return. When `nth` is 0 (which is the default), the indexes for the whole matched substring is returned; when `nth` is 1, then the 1st submatch capture's indexes are returned; when `nth` is 2, then the 2nd submatch capture is returned, and so on. When the specified submatch does not have a match, then two `nil` values will be returned. Below is an example for this:
1001
- ---
1002
- --- ```lua
1003
- --- local str = "hello, 1234"
1004
- --- local from, to = ngx.re.find(str, "([0-9])([0-9]+)", "jo", nil, 2)
1005
- --- if from then
1006
- --- ngx.say("matched 2nd submatch: ", string.sub(str, from, to)) -- yields "234"
1007
- --- end
1008
- --- ```
1009
- ---
1010
- ---@param subject string
1011
- ---@param regex string
1012
- ---@param options? ngx.re.options
1013
- ---@param ctx? ngx.re.ctx
1014
- ---@param nth? integer
1015
- ---@return integer? from
1016
- ---@return integer? to
1017
- ---@return string? error
1018
- function ngx.re.find(subject, regex, options, ctx, nth) end
1019
-
1020
- --- Similar to `ngx.re.match`, but returns a Lua iterator instead, so as to let the user programmer iterate all the matches over the `<subject>` string argument with the PCRE `regex`.
1021
- ---
1022
- --- In case of errors, like seeing an ill-formed regular expression, `nil` and a string describing the error will be returned.
1023
- ---
1024
- --- Here is a small example to demonstrate its basic usage:
1025
- ---
1026
- --- ```lua
1027
- --- local iterator, err = ngx.re.gmatch("hello, world!", "([a-z]+)", "i")
1028
- --- if not iterator then
1029
- --- ngx.log(ngx.ERR, "error: ", err)
1030
- --- return
1031
- --- end
1032
- ---
1033
- --- local m
1034
- --- m, err = iterator() -- m[0] == m[1] == "hello"
1035
- --- if err then
1036
- --- ngx.log(ngx.ERR, "error: ", err)
1037
- --- return
1038
- --- end
1039
- ---
1040
- --- m, err = iterator() -- m[0] == m[1] == "world"
1041
- --- if err then
1042
- --- ngx.log(ngx.ERR, "error: ", err)
1043
- --- return
1044
- --- end
1045
- ---
1046
- --- m, err = iterator() -- m == nil
1047
- --- if err then
1048
- --- ngx.log(ngx.ERR, "error: ", err)
1049
- --- return
1050
- --- end
1051
- --- ```
1052
- ---
1053
- --- More often we just put it into a Lua loop:
1054
- ---
1055
- --- ```lua
1056
- --- local it, err = ngx.re.gmatch("hello, world!", "([a-z]+)", "i")
1057
- --- if not it then
1058
- --- ngx.log(ngx.ERR, "error: ", err)
1059
- --- return
1060
- --- end
1061
- ---
1062
- --- while true do
1063
- --- local m, err = it()
1064
- --- if err then
1065
- --- ngx.log(ngx.ERR, "error: ", err)
1066
- --- return
1067
- --- end
1068
- ---
1069
- --- if not m then
1070
- --- -- no match found (any more)
1071
- --- break
1072
- --- end
1073
- ---
1074
- --- -- found a match
1075
- --- ngx.say(m[0])
1076
- --- ngx.say(m[1])
1077
- --- end
1078
- --- ```
1079
- ---
1080
- --- The current implementation requires that the iterator returned should only be used in a single request. That is, one should *not* assign it to a variable belonging to persistent namespace like a Lua package.
1081
- ---
1082
- ---@alias ngx.re.gmatch.iterator fun():string,string
1083
- ---
1084
- ---@param subject string
1085
- ---@param regex string
1086
- ---@param options? ngx.re.options
1087
- ---@return ngx.re.gmatch.iterator? iterator
1088
- ---@return string? error
1089
- function ngx.re.gmatch(subject, regex, options) end
1090
-
1091
- --- Matches the `subject` string using the Perl compatible regular expression `regex` with the optional `options`.
1092
- ---
1093
- --- Only the first occurrence of the match is returned, or `nil` if no match is found. In case of errors, like seeing a bad regular expression or exceeding the PCRE stack limit, `nil` and a string describing the error will be returned.
1094
- ---
1095
- --- The optional fourth argument, `ctx`, can be a Lua table holding an optional `pos` field. When the `pos` field in the `ctx` table argument is specified, `ngx.re.match` will start matching from that offset (starting from 1). Regardless of the presence of the `pos` field in the `ctx` table, `ngx.re.match` will always set this `pos` field to the position *after* the substring matched by the whole pattern in case of a successful match. When match fails, the `ctx` table will be left intact.
1096
- ---
1097
- --- ```lua
1098
- --- local ctx = {}
1099
- --- local m, err = ngx.re.match("1234, hello", "[0-9]+", "", ctx)
1100
- --- -- m[0] = "1234"
1101
- --- -- ctx.pos == 5
1102
- --- ```
1103
- ---
1104
- --- ```lua
1105
- --- local ctx = { pos = 2 }
1106
- --- local m, err = ngx.re.match("1234, hello", "[0-9]+", "", ctx)
1107
- --- -- m[0] = "234"
1108
- --- -- ctx.pos == 5
1109
- --- ```
1110
- ---
1111
- --- The `ctx` table argument combined with the `a` regex modifier can be used to construct a lexer atop `ngx.re.match`.
1112
- ---
1113
- --- Note that, the `options` argument is not optional when the `ctx` argument is specified and that the empty Lua string (`""`) must be used as placeholder for `options` if no meaningful regex options are required.
1114
- ---
1115
- --- The optional 5th argument, `res_table`, allows the caller to supply the Lua table used to hold all the capturing results. Starting from `0.9.6`, it is the caller's responsibility to ensure this table is empty. This is very useful for recycling Lua tables and saving GC and table allocation overhead.
1116
- ---
1117
- ---@param subject string
1118
- ---@param regex string
1119
- ---@param options? ngx.re.options
1120
- ---@param ctx? ngx.re.ctx
1121
- ---@param res? ngx.re.captures
1122
- ---@return ngx.re.captures? captures
1123
- ---@return string? error
1124
- function ngx.re.match(subject, regex, options, ctx, res) end
1125
-
1126
- --- Just like `ngx.re.sub`, but does global substitution.
1127
- ---
1128
- --- Here is some examples:
1129
- ---
1130
- --- ```lua
1131
- --- local newstr, n, err = ngx.re.gsub("hello, world", "([a-z])[a-z]+", "[$0,$1]", "i")
1132
- --- if newstr then
1133
- --- -- newstr == "[hello,h], [world,w]"
1134
- --- -- n == 2
1135
- --- else
1136
- --- ngx.log(ngx.ERR, "error: ", err)
1137
- --- return
1138
- --- end
1139
- --- ```
1140
- ---
1141
- --- ```lua
1142
- --- local func = function (m)
1143
- --- return "[" .. m[0] .. "," .. m[1] .. "]"
1144
- --- end
1145
- --- local newstr, n, err = ngx.re.gsub("hello, world", "([a-z])[a-z]+", func, "i")
1146
- --- -- newstr == "[hello,h], [world,w]"
1147
- --- -- n == 2
1148
- --- ```
1149
- ---
1150
- ---@param subject string
1151
- ---@param regex string
1152
- ---@param replace ngx.re.replace
1153
- ---@param options? ngx.re.options
1154
- ---@return string? new
1155
- ---@return integer? n
1156
- ---@return string? error
1157
- function ngx.re.gsub(subject, regex, replace, options) end
1158
-
1159
- --- When `replace` is string, then it is treated as a special template for string replacement:
1160
- ---
1161
- --- ```lua
1162
- --- local newstr, n, err = ngx.re.sub("hello, 1234", "([0-9])[0-9]", "[$0][$1]")
1163
- --- if newstr then
1164
- --- -- newstr == "hello, [12][1]34"
1165
- --- -- n == 1
1166
- --- else
1167
- --- ngx.log(ngx.ERR, "error: ", err)
1168
- --- return
1169
- --- end
1170
- --- ```
1171
- ---
1172
- --- ...where `$0` refers to the whole substring matched by the pattern, and `$1` referring to the first parenthesized capturing substring.
1173
- ---
1174
- --- Curly braces can also be used to disambiguate variable names from the background string literals:
1175
- ---
1176
- --- ```lua
1177
- --- local newstr, n, err = ngx.re.sub("hello, 1234", "[0-9]", "${0}00")
1178
- --- -- newstr == "hello, 100234"
1179
- --- -- n == 1
1180
- --- ```
1181
- ---
1182
- --- Literal dollar sign characters (`$`) in the `replace` string argument can be escaped by another dollar sign:
1183
- ---
1184
- --- ```lua
1185
- --- local newstr, n, err = ngx.re.sub("hello, 1234", "[0-9]", "$$")
1186
- --- -- newstr == "hello, $234"
1187
- --- -- n == 1
1188
- --- ```
1189
- ---
1190
- --- Do not use backlashes to escape dollar signs; it will not work as expected.
1191
- ---@alias ngx.re.replace.string string
1192
-
1193
- --- When `replace` is a function, it will be invoked with the capture table as the argument to generate the replace string literal for substitution. The capture table fed into the `replace` function is exactly the same as the return value of `ngx.re.match`. Here is an example:
1194
- ---
1195
- --- ```lua
1196
- --- local func = function (m)
1197
- --- return "[" .. m[0] .. "][" .. m[1] .. "]"
1198
- --- end
1199
- --- local newstr, n, err = ngx.re.sub("hello, 1234", "( [0-9] ) [0-9]", func, "x")
1200
- --- -- newstr == "hello, [12][1]34"
1201
- --- -- n == 1
1202
- --- ```
1203
- ---
1204
- --- The dollar sign characters in the return value of the `replace` function argument are not special at all.
1205
- ---
1206
- ---@alias ngx.re.replace.fn fun(m:ngx.re.captures):string
1207
-
1208
- ---@alias ngx.re.replace ngx.re.replace.string|ngx.re.replace.fn
1209
-
1210
- --- Substitutes the first match of the Perl compatible regular expression `regex` on the `subject` argument string with the string or function argument `replace`.
1211
- ---
1212
- --- This method returns the resulting new string as well as the number of successful substitutions. In case of failures, like syntax errors in the regular expressions or the `<replace>` string argument, it will return `nil` and a string describing the error.
1213
- ---
1214
- ---@param subject string
1215
- ---@param regex string
1216
- ---@param replace ngx.re.replace
1217
- ---@param options? ngx.re.options
1218
- ---@return string? new
1219
- ---@return integer? n
1220
- ---@return string? error
1221
- function ngx.re.sub(subject, regex, replace, options) end
1222
-
1223
- --- Decodes the `str` argument as a base64 digest to the raw form. Returns `nil` if `str` is not well formed.
1224
- ---
1225
- ---@param str string
1226
- ---@return string
1227
- function ngx.decode_base64(str) end
1228
-
1229
- --- Encodes `str` to a base64 digest.
1230
- ---
1231
- --- An optional boolean-typed `no_padding` argument can be specified to control whether the base64 padding should be appended to the resulting digest (default to `false`, i.e., with padding enabled).
1232
- ---
1233
- ---@param str string
1234
- ---@param no_padding? boolean
1235
- ---@return string
1236
- function ngx.encode_base64(str, no_padding) end
1237
-
1238
- --- Fetching the shm-based Lua dictionary object for the shared memory zone named `DICT` defined by the `lua_shared_dict` directive.
1239
- ---
1240
- --- All these methods are *atomic* operations, that is, safe from concurrent accesses from multiple NGINX worker processes for the same `lua_shared_dict` zone.
1241
- ---
1242
- --- The shared dictionary will retain its contents through a server config reload (either by sending the `HUP` signal to the NGINX process or by using the `-s reload` command-line option).
1243
- ---
1244
- --- The contents in the dictionary storage will be lost, however, when the NGINX server quits.
1245
- ---
1246
- ---@type table<string,ngx.shared.DICT>
1247
- ngx.shared = {}
1248
-
1249
- ---@class ngx.shared.DICT
1250
- local DICT = {}
1251
-
1252
- --- Valid key types for ngx.shared.DICT
1253
- ---
1254
- ---@alias ngx.shared.DICT.key
1255
- ---| string
1256
- ---| number
1257
-
1258
- --- Valid values for ngx.shared.DICT
1259
- ---@alias ngx.shared.DICT.value
1260
- ---| string
1261
- ---| number
1262
- ---| boolean
1263
- ---| nil
1264
-
1265
- --- Retrieve a value. If the key does not exist or has expired, then `nil` will be returned.
1266
- ---
1267
- --- In case of errors, `nil` and a string describing the error will be returned.
1268
- ---
1269
- --- The value returned will have the original data type when they were inserted into the dictionary, for example, Lua booleans, numbers, or strings.
1270
- ---
1271
- --- ```lua
1272
- --- local cats = ngx.shared.cats
1273
- --- local value, flags = cats:get("Marry")
1274
- --- ```
1275
- ---
1276
- --- If the user flags is `0` (the default), then no flags value will be returned.
1277
- ---
1278
- ---@param key ngx.shared.DICT.key
1279
- ---@return ngx.shared.DICT.value? value
1280
- ---@return ngx.shared.DICT.flags|string|nil flags_or_error
1281
- function DICT:get(key) end
1282
-
1283
- --- Similar to the `get` method but returns the value even if the key has already expired.
1284
- ---
1285
- --- Returns a 3rd value, `stale`, indicating whether the key has expired or not.
1286
- ---
1287
- --- Note that the value of an expired key is not guaranteed to be available so one should never rely on the availability of expired items.
1288
- ---
1289
- ---@param key ngx.shared.DICT.key
1290
- ---@return ngx.shared.DICT.value? value
1291
- ---@return ngx.shared.DICT.flags|string flags_or_error
1292
- ---@return boolean stale
1293
- function DICT:get_stale(key) end
1294
-
1295
- ---@alias ngx.shared.DICT.error string
1296
- ---| '"no memory"' # not enough available memory to store a value
1297
- ---| '"exists"' # called add() on an existing value
1298
- ---| '"not found"' # called a method (replace/ttl/expire) on an absent value
1299
- ---| '"not a number"' # called incr() on a non-number value
1300
- ---| '"value not a list"' # called list methods (lpush/lpop/rpush/rpop/llen) on a non-list value
1301
-
1302
- --- Optional user flags associated with a shm value.
1303
- ---
1304
- --- The user flags is stored as an unsigned 32-bit integer internally. Defaults to `0`.
1305
- ---
1306
- ---@alias ngx.shared.DICT.flags integer
1307
-
1308
- --- Expiration time of an shm value (in seconds)
1309
- ---
1310
- --- The time resolution is `0.001` seconds.
1311
- --- If this value is set to `0` (the default), the shm value will never expire.
1312
- ---
1313
- ---@alias ngx.shared.DICT.exptime number
1314
-
1315
- --- Unconditionally sets a key-value pair into the shm-based dictionary.
1316
- ---
1317
- --- When it fails to allocate memory for the current key-value item, then `set` will try removing existing items in the storage according to the Least-Recently Used (LRU) algorithm. Note that, LRU takes priority over expiration time here. If up to tens of existing items have been removed and the storage left is still insufficient (either due to the total capacity limit specified by `lua_shared_dict` or memory segmentation), then the `err` return value will be `no memory` and `success` will be `false`.
1318
- ---
1319
- --- If this method succeeds in storing the current item by forcibly removing other not-yet-expired items in the dictionary via LRU, the `forcible` return value will be `true`. If it stores the item without forcibly removing other valid items, then the return value `forcible` will be `false`.
1320
- ---
1321
- --- ```lua
1322
- --- local cats = ngx.shared.cats
1323
- --- local succ, err, forcible = cats:set("Marry", "it is a nice cat!")
1324
- --- ```
1325
- ---
1326
- --- Please note that while internally the key-value pair is set atomically, the atomicity does not go across the method call boundary.
1327
- ---
1328
- ---@param key ngx.shared.DICT.key
1329
- ---@param value ngx.shared.DICT.value
1330
- ---@param exptime? ngx.shared.DICT.exptime
1331
- ---@param flags? ngx.shared.DICT.flags
1332
- ---@return boolean ok # whether the key-value pair is stored or not
1333
- ---@return ngx.shared.DICT.error? error
1334
- ---@return boolean forcible # indicates whether other valid items have been removed forcibly when out of storage in the shared memory zone.
1335
- function DICT:set(key, value, exptime, flags) end
1336
-
1337
- --- Similar to the `set` method, but never overrides the (least recently used) unexpired items in the store when running out of storage in the shared memory zone. In this case, it will immediately return `nil` and the string "no memory".
1338
- ---
1339
- ---@param key ngx.shared.DICT.key
1340
- ---@param value ngx.shared.DICT.value
1341
- ---@param exptime? ngx.shared.DICT.exptime
1342
- ---@param flags? ngx.shared.DICT.flags
1343
- ---@return boolean ok # whether the key-value pair is stored or not
1344
- ---@return ngx.shared.DICT.error? error
1345
- ---@return boolean forcible # indicates whether other valid items have been removed forcibly when out of storage in the shared memory zone.
1346
- function DICT:safe_set(key, value, exptime, flags) end
1347
-
1348
- --- Just like the `set` method, but only stores the key-value pair if the key does *not* exist.
1349
- ---
1350
- --- If the `key` argument already exists in the dictionary (and not expired for sure), the `success` return value will be `false` and the `err` return value will be `"exists"`.
1351
- ---
1352
- ---@param key ngx.shared.DICT.key
1353
- ---@param value ngx.shared.DICT.value
1354
- ---@param exptime? ngx.shared.DICT.exptime
1355
- ---@param flags? ngx.shared.DICT.flags
1356
- ---@return boolean ok # whether the key-value pair is stored or not
1357
- ---@return ngx.shared.DICT.error? error
1358
- ---@return boolean forcible # indicates whether other valid items have been removed forcibly when out of storage in the shared memory zone.
1359
- function DICT:add(key, value, exptime, flags) end
1360
-
1361
- --- Similar to the `add` method, but never overrides the (least recently used) unexpired items in the store when running out of storage in the shared memory zone. In this case, it will immediately return `nil` and the string "no memory".
1362
- ---
1363
- ---@param key ngx.shared.DICT.key
1364
- ---@param value ngx.shared.DICT.value
1365
- ---@param exptime? ngx.shared.DICT.exptime
1366
- ---@param flags? ngx.shared.DICT.flags
1367
- ---@return boolean ok # whether the key-value pair is stored or not
1368
- ---@return ngx.shared.DICT.error? error
1369
- ---@return boolean forcible # indicates whether other valid items have been removed forcibly when out of storage in the shared memory zone.
1370
- function DICT:safe_add(key, value, exptime, flags) end
1371
-
1372
- --- Just like the `set` method, but only stores the key-value pair if the key *does* exist.
1373
- ---
1374
- --- If the `key` argument does *not* exist in the dictionary (or expired already), the `success` return value will be `false` and the `err` return value will be `"not found"`.
1375
- ---
1376
- ---@param key ngx.shared.DICT.key
1377
- ---@param value ngx.shared.DICT.value
1378
- ---@param exptime? ngx.shared.DICT.exptime
1379
- ---@param flags? ngx.shared.DICT.flags
1380
- ---@return boolean ok # whether the key-value pair is stored or not
1381
- ---@return ngx.shared.DICT.error? error
1382
- ---@return boolean forcible # indicates whether other valid items have been removed forcibly when out of storage in the shared memory zone.
1383
- function DICT:replace(key, value, exptime, flags) end
1384
-
1385
- --- Unconditionally removes the key-value pair.
1386
- ---
1387
- --- It is equivalent to `ngx.shared.DICT:set(key, nil)`.
1388
- ---
1389
- ---@param key ngx.shared.DICT.key
1390
- function DICT:delete(key) end
1391
-
1392
- --- Increments the (numerical) value for `key` by the step value `value`. Returns the new resulting number if the operation is successfully completed or `nil` and an error message otherwise.
1393
- ---
1394
- --- When the key does not exist or has already expired in the shared dictionary,
1395
- ---
1396
- --- 1. if the `init` argument is not specified or takes the value `nil`, this method will return `nil` and the error string `"not found"`, or
1397
- --- 1. if the `init` argument takes a number value, this method will create a new `key` with the value `init + value`.
1398
- ---
1399
- --- Like the `add` method, it also overrides the (least recently used) unexpired items in the store when running out of storage in the shared memory zone.
1400
- ---
1401
- --- The optional `init_ttl` argument specifies expiration time (in seconds) of the value when it is initialized via the `init` argument. This argument cannot be provided without providing the `init` argument as well, and has no effect if the value already exists (e.g., if it was previously inserted via `set` or the likes).
1402
- ---
1403
- --- ```lua
1404
- --- local cats = ngx.shared.cats
1405
- --- local newval, err = cats:incr("black_cats", 1, 0, 0.1)
1406
- ---
1407
- --- print(newval) -- 1
1408
- ---
1409
- --- ngx.sleep(0.2)
1410
- ---
1411
- --- local val, err = cats:get("black_cats")
1412
- --- print(val) -- nil
1413
- --- ```
1414
- ---
1415
- --- The `forcible` return value will always be `nil` when the `init` argument is not specified.
1416
- ---
1417
- --- If this method succeeds in storing the current item by forcibly removing other not-yet-expired items in the dictionary via LRU, the `forcible` return value will be `true`. If it stores the item without forcibly removing other valid items, then the return value `forcible` will be `false`.
1418
- ---
1419
- --- If the original value is not a valid Lua number in the dictionary, it will return `nil` and `"not a number"`.
1420
- ---
1421
- --- The `value` argument and `init` argument can be any valid Lua numbers, like negative numbers or floating-point numbers.
1422
- ---
1423
- ---
1424
- ---@param key ngx.shared.DICT.key
1425
- ---@param value number
1426
- ---@param init? number
1427
- ---@param init_ttl? ngx.shared.DICT.exptime
1428
- ---@return integer? new
1429
- ---@return ngx.shared.DICT.error? error
1430
- ---@return boolean forcible
1431
- function DICT:incr(key, value, init, init_ttl) end
1432
-
1433
- --- Valid ngx.shared.DICT value for lists
1434
- ---@alias ngx.shared.DICT.list_value
1435
- ---| string
1436
- ---| number
1437
-
1438
- --- Inserts the specified (numerical or string) `value` at the head of the list named `key`.
1439
- ---
1440
- --- If `key` does not exist, it is created as an empty list before performing the push operation. When the `key` already takes a value that is not a list, it will return `nil` and `"value not a list"`.
1441
- ---
1442
- --- It never overrides the (least recently used) unexpired items in the store when running out of storage in the shared memory zone. In this case, it will immediately return `nil` and the string "no memory".
1443
- ---
1444
- ---@param key ngx.shared.DICT.key
1445
- ---@param value ngx.shared.DICT.list_value
1446
- ---@return number? len # number of elements in the list after the push operation
1447
- ---@return ngx.shared.DICT.error? error
1448
- function DICT:lpush(key, value) end
1449
-
1450
- --- Similar to the `lpush` method, but inserts the specified (numerical or string) `value` at the tail of the list named `key`.
1451
- ---
1452
- ---@param key ngx.shared.DICT.key
1453
- ---@param value ngx.shared.DICT.list_value
1454
- ---@return number? len # number of elements in the list after the push operation
1455
- ---@return ngx.shared.DICT.error? error
1456
- function DICT:rpush(key, value) end
1457
-
1458
- --- Removes and returns the first element of the list named `key`.
1459
- ---
1460
- --- If `key` does not exist, it will return `nil`. When the `key` already takes a value that is not a list, it will return `nil` and `"value not a list"`.
1461
- ---
1462
- ---@param key ngx.shared.DICT.key
1463
- ---@return ngx.shared.DICT.list_value? item
1464
- ---@return ngx.shared.DICT.error? error
1465
- function DICT:lpop(key) end
1466
-
1467
- --- Removes and returns the last element of the list named `key`.
1468
- ---
1469
- --- If `key` does not exist, it will return `nil`. When the `key` already takes a value that is not a list, it will return `nil` and `"value not a list"`.
1470
- ---
1471
- ---@param key ngx.shared.DICT.key
1472
- ---@return ngx.shared.DICT.list_value? item
1473
- ---@return ngx.shared.DICT.error? error
1474
- function DICT:rpop(key) end
1475
-
1476
- --- Returns the number of elements in the list named `key`.
1477
- ---
1478
- --- If key does not exist, it is interpreted as an empty list and 0 is returned. When the `key` already takes a value that is not a list, it will return `nil` and `"value not a list"`.
1479
- ---
1480
- ---@param key ngx.shared.DICT.key
1481
- ---@return number? len
1482
- ---@return ngx.shared.DICT.error? error
1483
- function DICT:llen(key) end
1484
-
1485
- --- Retrieves the remaining TTL (time-to-live in seconds) of a key-value pair.
1486
- ---
1487
- --- Returns the TTL as a number if the operation is successfully completed or `nil` and an error message otherwise.
1488
- ---
1489
- --- If the key does not exist (or has already expired), this method will return `nil` and the error string `"not found"`.
1490
- ---
1491
- --- The TTL is originally determined by the `exptime` argument of the `set`, `add`, `replace` (and the likes) methods. It has a time resolution of `0.001` seconds. A value of `0` means that the item will never expire.
1492
- ---
1493
- --- Example:
1494
- ---
1495
- --- ```lua
1496
- --- local cats = ngx.shared.cats
1497
- --- local succ, err = cats:set("Marry", "a nice cat", 0.5)
1498
- ---
1499
- --- ngx.sleep(0.2)
1500
- ---
1501
- --- local ttl, err = cats:ttl("Marry")
1502
- --- ngx.say(ttl) -- 0.3
1503
- --- ```
1504
- ---@param key ngx.shared.DICT.key
1505
- ---@return number? ttl
1506
- ---@return ngx.shared.DICT.error? error
1507
- function DICT:ttl(key) end
1508
-
1509
- --- Updates the `exptime` (in second) of a key-value pair.
1510
- ---
1511
- --- Returns a boolean indicating success if the operation completes or `nil` and an error message otherwise.
1512
- ---
1513
- --- If the key does not exist, this method will return `nil` and the error string `"not found"`.
1514
- ---
1515
- --- ```lua
1516
- --- local cats = ngx.shared.cats
1517
- --- local succ, err = cats:set("Marry", "a nice cat", 0.1)
1518
- ---
1519
- --- succ, err = cats:expire("Marry", 0.5)
1520
- ---
1521
- --- ngx.sleep(0.2)
1522
- ---
1523
- --- local val, err = cats:get("Marry")
1524
- --- ngx.say(val) -- "a nice cat"
1525
- --- ```
1526
- ---
1527
- ---@param key ngx.shared.DICT.key
1528
- ---@param exptime ngx.shared.DICT.exptime
1529
- ---@return boolean ok
1530
- ---@return ngx.shared.DICT.error? error
1531
- function DICT:expire(key, exptime) end
1532
-
1533
- --- Flushes out all the items in the dictionary. This method does not actuall free up all the memory blocks in the dictionary but just marks all the existing items as expired.
1534
- ---
1535
- function DICT:flush_all() end
1536
-
1537
- --- Flushes out the expired items in the dictionary, up to the maximal number specified by the optional `max_count` argument. When the `max_count` argument is given `0` or not given at all, then it means unlimited. Returns the number of items that have actually been flushed.
1538
- ---
1539
- --- Unlike the `flush_all` method, this method actually frees up the memory used by the expired items.
1540
- ---
1541
- ---@param max_count? number
1542
- ---@return number flushed
1543
- function DICT:flush_expired(max_count) end
1544
-
1545
- --- Fetch a list of the keys from the dictionary, up to `<max_count>`.
1546
- ---
1547
- --- By default, only the first 1024 keys (if any) are returned. When the `<max_count>` argument is given the value `0`, then all the keys will be returned even there is more than 1024 keys in the dictionary.
1548
- ---
1549
- --- **CAUTION** Avoid calling this method on dictionaries with a very large number of keys as it may lock the dictionary for significant amount of time and block NGINX worker processes trying to access the dictionary.
1550
- ---
1551
- ---@param max_count? number
1552
- ---@return string[] keys
1553
- function DICT:get_keys(max_count) end
1554
-
1555
- --- Retrieves the capacity in bytes for the shm-based dictionary.
1556
- ---
1557
- --- ```lua
1558
- --- local cats = ngx.shared.cats
1559
- --- local capacity_bytes = cats:capacity()
1560
- --- ```
1561
- ---
1562
- ---@return number
1563
- function DICT:capacity() end
1564
-
1565
- --- Retrieves the free page size in bytes for the shm-based dictionary.
1566
- ---
1567
- --- **Note:** The memory for ngx.shared.DICT is allocated via the NGINX slab allocator which has each slot for
1568
- --- data size ranges like \~8, 9\~16, 17\~32, ..., 1025\~2048, 2048\~ bytes. And pages are assigned to a slot if there is no room in already assigned pages for the slot.
1569
- ---
1570
- --- So even if the return value of the `free_space` method is zero, there may be room in already assigned pages, so
1571
- --- you may successfully set a new key value pair to the shared dict without getting `true` for `forcible` or
1572
- --- non nil `err` from the `ngx.shared.DICT.set`.
1573
- ---
1574
- --- On the other hand, if already assigned pages for a slot are full and a new key value pair is added to the
1575
- --- slot and there is no free page, you may get `true` for `forcible` or non nil `err` from the
1576
- --- `ngx.shared.DICT.set` method.
1577
- ---
1578
- --- ```lua
1579
- --- local cats = ngx.shared.cats
1580
- --- local free_page_bytes = cats:free_space()
1581
- --- ```
1582
- ---
1583
- ---@return number
1584
- function DICT:free_space() end
1585
-
1586
- --- Read and write NGINX variable values.
1587
- ---
1588
- --- Usage:
1589
- ---
1590
- ---```lua
1591
- --- value = ngx.var.some_nginx_variable_name
1592
- --- ngx.var.some_nginx_variable_name = value
1593
- ---```
1594
- ---
1595
- --- Note that only already defined NGINX variables can be written to.
1596
- --- For example:
1597
- ---
1598
- --- ```nginx
1599
- --- location /foo {
1600
- --- set $my_var ''; # this line is required to create $my_var at config time
1601
- --- content_by_lua_block {
1602
- --- ngx.var.my_var = 123
1603
- --- ...
1604
- --- }
1605
- --- }
1606
- --- ```
1607
- ---
1608
- --- That is, NGINX variables cannot be created on-the-fly.
1609
- ---
1610
- --- Some special NGINX variables like `$args` and `$limit_rate` can be assigned a value,
1611
- --- many others are not, like `$query_string`, `$arg_PARAMETER`, and `$http_NAME`.
1612
- ---
1613
- --- NGINX regex group capturing variables `$1`, `$2`, `$3`, and etc, can be read by this
1614
- --- interface as well, by writing `ngx.var[1]`, `ngx.var[2]`, `ngx.var[3]`, and etc.
1615
- ---
1616
- --- Setting `ngx.var.Foo` to a `nil` value will unset the `$Foo` NGINX variable.
1617
- ---
1618
- --- ```lua
1619
- --- ngx.var.args = nil
1620
- --- ```
1621
- ---
1622
- --- **CAUTION** When reading from an NGINX variable, NGINX will allocate memory in the per-request memory pool which is freed only at request termination. So when you need to read from an NGINX variable repeatedly in your Lua code, cache the NGINX variable value to your own Lua variable, for example,
1623
- ---
1624
- --- ```lua
1625
- --- local val = ngx.var.some_var
1626
- --- --- use the val repeatedly later
1627
- --- ```
1628
- ---
1629
- --- to prevent (temporary) memory leaking within the current request's lifetime. Another way of caching the result is to use the `ngx.ctx` table.
1630
- ---
1631
- --- Undefined NGINX variables are evaluated to `nil` while uninitialized (but defined) NGINX variables are evaluated to an empty Lua string.
1632
- ---
1633
- --- This API requires a relatively expensive metamethod call and it is recommended to avoid using it on hot code paths.
1634
- ---
1635
- ---@type table
1636
- ngx.var = {}
1637
-
1638
- --- Embedded Variables
1639
- --- see https://nginx.org/en/docs/http/ngx_http_core_module.html#variables
1640
-
1641
- --- client address in a binary form, value’s length is always 4 bytes for IPv4 addresses or 16 bytes for IPv6 addresses
1642
- ---@type string
1643
- ngx.var.binary_remote_addr = nil
1644
-
1645
- --- number of bytes sent to a client, not counting the response header; this variable is compatible with the “%B” parameter of the mod_log_config Apache module
1646
- ---@type number
1647
- ngx.var.body_bytes_sent = nil
1648
-
1649
- --- number of bytes sent to a client (1.3.8, 1.2.5)
1650
- ---@type number
1651
- ngx.var.bytes_sent = nil
1652
-
1653
- --- connection serial number (1.3.8, 1.2.5)
1654
- ---@type string
1655
- ngx.var.connection = nil
1656
-
1657
- --- current number of requests made through a connection (1.3.8, 1.2.5)
1658
- ---@type string
1659
- ngx.var.connection_requests = nil
1660
-
1661
- --- connection time in seconds with a milliseconds resolution (1.19.10)
1662
- ---@type string
1663
- ngx.var.connection_time = nil
1664
-
1665
- --- “Content-Length” request header field
1666
- ---@type string
1667
- ngx.var.content_length = nil
1668
-
1669
- --- “Content-Type” request header field
1670
- ---@type string
1671
- ngx.var.content_type = nil
1672
-
1673
- --- root or alias directive’s value for the current request
1674
- ---@type string
1675
- ngx.var.document_root = nil
1676
-
1677
- --- same as ngx.var.uri
1678
- ---@type string
1679
- ngx.var.document_uri = nil
1680
-
1681
- --- in this order of precedence: host name from the request line, or host name from the “Host” request header field, or the server name matching a request
1682
- ---@type string
1683
- ngx.var.host = nil
1684
-
1685
- --- host name
1686
- ---@type string
1687
- ngx.var.hostname = nil
1688
-
1689
- --- “on” if connection operates in SSL mode, or an empty string otherwise
1690
- ---@type string '"on"'|'""'
1691
- ngx.var.https = nil
1692
-
1693
- --- “?” if a request line has arguments, or an empty string otherwise
1694
- ---@type string
1695
- ngx.var.is_args = nil
1696
-
1697
- --- setting this variable enables response rate limiting; see limit_rate
1698
- ---@type string
1699
- ngx.var.limit_rate = nil
1700
-
1701
- --- current time in seconds with the milliseconds resolution (1.3.9, 1.2.6)
1702
- ---@type string
1703
- ngx.var.msec = nil
1704
-
1705
- --- nginx version
1706
- ---@type string
1707
- ngx.var.nginx_version = nil
1708
-
1709
- --- PID of the worker process
1710
- ---@type string
1711
- ngx.var.pid = nil
1712
-
1713
- --- “p” if request was pipelined, “.” otherwise (1.3.12, 1.2.7)
1714
- ---@type string
1715
- ngx.var.pipe = nil
1716
-
1717
- --- client address from the PROXY protocol header (1.5.12)
1718
- --- The PROXY protocol must be previously enabled by setting the proxy_protocol parameter in the listen directive.
1719
- ---@type string
1720
- ngx.var.proxy_protocol_addr = nil
1721
-
1722
- --- client port from the PROXY protocol header (1.11.0)
1723
- ---
1724
- --- The PROXY protocol must be previously enabled by setting the proxy_protocol parameter in the listen directive.
1725
- ---@type string
1726
- ngx.var.proxy_protocol_port = nil
1727
-
1728
- --- server address from the PROXY protocol header (1.17.6)
1729
- ---
1730
- --- The PROXY protocol must be previously enabled by setting the proxy_protocol parameter in the listen directive.
1731
- ---@type string
1732
- ngx.var.proxy_protocol_server_addr = nil
1733
-
1734
- --- server port from the PROXY protocol header (1.17.6)
1735
- ---
1736
- --- The PROXY protocol must be previously enabled by setting the proxy_protocol parameter in the listen directive.
1737
- ---@type string
1738
- ngx.var.proxy_protocol_server_port = nil
1739
-
1740
- --- same as ngx.var.args
1741
- ---@type string
1742
- ngx.var.query_string = nil
1743
-
1744
- --- an absolute pathname corresponding to the root or alias directive’s value for the current request, with all symbolic links resolved to real paths
1745
- ---@type string
1746
- ngx.var.realpath_root = nil
1747
-
1748
- --- client address
1749
- ---@type string
1750
- ngx.var.remote_addr = nil
1751
-
1752
- --- client port
1753
- ---@type string
1754
- ngx.var.remote_port = nil
1755
-
1756
- --- user name supplied with the Basic authentication
1757
- ---@type string
1758
- ngx.var.remote_user = nil
1759
-
1760
- --- full original request line
1761
- ---@type string
1762
- ngx.var.request = nil
1763
-
1764
- --- request body
1765
- ---
1766
- --- The variable’s value is made available in locations processed by the proxy_pass, fastcgi_pass, uwsgi_pass, and scgi_pass directives when the request body was read to a memory buffer.
1767
- ---@type string
1768
- ngx.var.request_body = nil
1769
-
1770
- --- name of a temporary file with the request body
1771
- ---
1772
- --- At the end of processing, the file needs to be removed.
1773
- --- To always write the request body to a file, client_body_in_file_only needs to be enabled.
1774
- --- When the name of a temporary file is passed in a proxied request or in a request to a FastCGI/uwsgi/SCGI server, passing the request body should be disabled by the proxy_pass_request_body off, fastcgi_pass_request_body off, uwsgi_pass_request_body off, or scgi_pass_request_body off directives, respectively.
1775
- ---@type string
1776
- ngx.var.request_body_file = nil
1777
-
1778
- --- “OK” if a request has completed, or an empty string otherwise
1779
- ---@type string
1780
- ngx.var.request_completion = nil
1781
-
1782
- --- file path for the current request, based on the root or alias directives, and the request URI
1783
- ---@type string
1784
- ngx.var.request_filename = nil
1785
-
1786
- --- unique request identifier generated from 16 random bytes, in hexadecimal (1.11.0)
1787
- ---@type string
1788
- ngx.var.request_id = nil
1789
-
1790
- --- request length (including request line, header, and request body) (1.3.12, 1.2.7)
1791
- ---@type string
1792
- ngx.var.request_length = nil
1793
-
1794
- --- request method, usually “GET” or “POST”
1795
- ---@type string
1796
- ngx.var.request_method = nil
1797
-
1798
- --- request processing time in seconds with a milliseconds resolution (1.3.9, 1.2.6); time elapsed since the first bytes were read from the client
1799
- ---@type string
1800
- ngx.var.request_time = nil
1801
-
1802
- --- full original request URI (with arguments)
1803
- ---@type string
1804
- ngx.var.request_uri = nil
1805
-
1806
- --- request scheme, “http” or “https”
1807
- ---@type string
1808
- ngx.var.scheme = nil
1809
-
1810
- --- an address of the server which accepted a request
1811
- ---
1812
- --- Computing a value of this variable usually requires one system call. To avoid a system call, the listen directives must specify addresses and use the bind parameter.
1813
- ---@type string
1814
- ngx.var.server_addr = nil
1815
-
1816
- --- name of the server which accepted a request
1817
- ---@type string
1818
- ngx.var.server_name = nil
1819
-
1820
- --- port of the server which accepted a request
1821
- ---@type string
1822
- ngx.var.server_port = nil
1823
-
1824
- --- request protocol, usually “HTTP/1.0”, “HTTP/1.1”, or “HTTP/2.0”
1825
- ---@type string
1826
- ngx.var.server_protocol = nil
1827
-
1828
- --- response status (1.3.2, 1.2.2)
1829
- ---@type string
1830
- ngx.var.status = nil
1831
-
1832
- --- local time in the ISO 8601 standard format (1.3.12, 1.2.7)
1833
- ---@type string
1834
- ngx.var.time_iso8601 = nil
1835
-
1836
- --- local time in the Common Log Format (1.3.12, 1.2.7)
1837
- ---@type string
1838
- ngx.var.time_local = nil
1839
-
1840
- --- current URI in request, normalized
1841
- --- The value of $uri may change during request processing, e.g. when doing internal redirects, or when using index files.
1842
- ---@type string
1843
- ngx.var.uri = nil
1844
-
1845
- --- Updating query arguments via the NGINX variable `$args` (or `ngx.var.args` in Lua) at runtime is also supported:
1846
- ---
1847
- --- ```lua
1848
- --- ngx.var.args = "a=3&b=42"
1849
- --- local args, err = ngx.req.get_uri_args()
1850
- --- ```
1851
- ---
1852
- --- Here the `args` table will always look like
1853
- ---
1854
- --- ```lua
1855
- --- {a = 3, b = 42}
1856
- --- ```
1857
- ---
1858
- --- regardless of the actual request query string.
1859
- ---@type string
1860
- ngx.var.args = nil
1861
-
1862
- --- embedded upstream variables
1863
- --- https://nginx.org/en/docs/http/ngx_http_upstream_module.html#variables
1864
-
1865
- --- IP address and port, or the path to the UNIX-domain socket of the upstream server.
1866
- --- If several servers were contacted during request processing, their addresses are separated by commas, e.g. “192.168.1.1:80, 192.168.1.2:80, unix:/tmp/sock”.
1867
- --- If an internal redirect from one server group to another happens, initiated by “X-Accel-Redirect” or error_page, then the server addresses from different groups are separated by colons, e.g. “192.168.1.1:80, 192.168.1.2:80, unix:/tmp/sock : 192.168.10.1:80, 192.168.10.2:80”.
1868
- --- If a server cannot be selected, the variable keeps the name of the server group.
1869
- ---@type string
1870
- ngx.var.upstream_addr = nil
1871
-
1872
- --- number of bytes received from an upstream server (1.11.4). Values from several connections are separated by commas and colons like addresses in the $upstream_addr variable.
1873
- ---@type string
1874
- ngx.var.upstream_bytes_received = nil
1875
-
1876
- --- number of bytes sent to an upstream server (1.15.8). Values from several connections are separated by commas and colons like addresses in the $upstream_addr variable.
1877
- ---@type string
1878
- ngx.var.upstream_bytes_sent = nil
1879
-
1880
- --- status of accessing a response cache (0.8.3). The status can be either “MISS”, “BYPASS”, “EXPIRED”, “STALE”, “UPDATING”, “REVALIDATED”, or “HIT”.
1881
- ---@type string
1882
- ngx.var.upstream_cache_status = nil
1883
-
1884
- --- time spent on establishing a connection with the upstream server (1.9.1)
1885
- --
1886
- --- the time is kept in seconds with millisecond resolution.
1887
- --- In case of SSL, includes time spent on handshake.
1888
- --- Times of several connections are separated by commas and colons like addresses in the $upstream_addr variable.
1889
- ---@type string
1890
- ngx.var.upstream_connect_time = nil
1891
-
1892
- --- time spent on receiving the response header from the upstream server (1.7.10)
1893
- --- the time is kept in seconds with millisecond resolution.
1894
- --- Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
1895
- ---@type string
1896
- ngx.var.upstream_header_time = nil
1897
-
1898
- --- the time the request spent in the upstream queue (1.13.9).
1899
- --- the time is kept in seconds with millisecond resolution.
1900
- --- Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
1901
- ---@type string
1902
- ngx.var.upstream_queue_time = nil
1903
-
1904
- --- the length of the response obtained from the upstream server (0.7.27).
1905
- --- the length is kept in bytes.
1906
- --- Lengths of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
1907
- ---@type string
1908
- ngx.var.upstream_response_length = nil
1909
-
1910
- --- time spent on receiving the response from the upstream server
1911
- ---
1912
- --- the time is kept in seconds with millisecond resolution.
1913
- --- Times of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
1914
- ---@type string
1915
- ngx.var.upstream_response_time = nil
1916
-
1917
- --- status code of the response obtained from the upstream server.
1918
- --- Status codes of several responses are separated by commas and colons like addresses in the $upstream_addr variable.
1919
- --- If a server cannot be selected, the variable keeps the 502 (Bad Gateway) status code.
1920
- ---@type string
1921
- ngx.var.upstream_status = nil
1922
-
1923
- ngx.req = {}
1924
-
1925
- --- Returns a boolean indicating whether the current request is an "internal request", i.e.,
1926
- --- a request initiated from inside the current NGINX server instead of from the client side.
1927
- ---
1928
- --- Subrequests are all internal requests and so are requests after internal redirects.
1929
- ---
1930
- ---@return boolean
1931
- function ngx.req.is_internal() end
1932
-
1933
- --- Returns the HTTP version number for the current request as a Lua number.
1934
- ---
1935
- --- Current possible values are 2.0, 1.0, 1.1, and 0.9. Returns `nil` for unrecognized values.
1936
- ---
1937
- ---@return '2.0'|'1.0'|'1.1'|'0.9'|'nil'
1938
- function ngx.req.http_version() end
1939
-
1940
- --- Set the current request's request body using the in-memory data specified by the `data` argument.
1941
- ---
1942
- --- If the request body has not been read yet, call `ngx.req.read_body` first (or turn on `lua_need_request_body` to force this module to read the request body. This is not recommended however). Additionally, the request body must not have been previously discarded by `ngx.req.discard_body`.
1943
- ---
1944
- --- Whether the previous request body has been read into memory or buffered into a disk file, it will be freed or the disk file will be cleaned up immediately, respectively.
1945
- ---
1946
- ---@param data any
1947
- function ngx.req.set_body_data(data) end
1948
-
1949
- --- Returns a Lua table holding all the current request POST query arguments (of the MIME type `application/x-www-form-urlencoded`). Call `ngx.req.read_body` to read the request body first or turn on the `lua_need_request_body` directive to avoid errors.
1950
- ---
1951
- --- ```nginx
1952
- --- location = /test {
1953
- --- content_by_lua_block {
1954
- --- ngx.req.read_body()
1955
- --- local args, err = ngx.req.get_post_args()
1956
- ---
1957
- --- if err == "truncated" then
1958
- --- -- one can choose to ignore or reject the current request here
1959
- --- end
1960
- ---
1961
- --- if not args then
1962
- --- ngx.say("failed to get post args: ", err)
1963
- --- return
1964
- --- end
1965
- --- for key, val in pairs(args) do
1966
- --- if type(val) == "table" then
1967
- --- ngx.say(key, ": ", table.concat(val, ", "))
1968
- --- else
1969
- --- ngx.say(key, ": ", val)
1970
- --- end
1971
- --- end
1972
- --- }
1973
- --- }
1974
- --- ```
1975
- ---
1976
- --- Then
1977
- ---
1978
- --- ```bash
1979
- --- # Post request with the body 'foo=bar&bar=baz&bar=blah'
1980
- --- $ curl --data 'foo=bar&bar=baz&bar=blah' localhost/test
1981
- --- ```
1982
- ---
1983
- --- will yield the response body like
1984
- ---
1985
- --- ```bash
1986
- --- foo: bar
1987
- --- bar: baz, blah
1988
- --- ```
1989
- ---
1990
- --- Multiple occurrences of an argument key will result in a table value holding all of the values for that key in order.
1991
- ---
1992
- --- Keys and values will be unescaped according to URI escaping rules.
1993
- ---
1994
- --- With the settings above,
1995
- ---
1996
- --- ```bash
1997
- --- # POST request with body 'a%20b=1%61+2'
1998
- --- $ curl -d 'a%20b=1%61+2' localhost/test
1999
- --- ```
2000
- ---
2001
- --- will yield:
2002
- ---
2003
- --- ```bash
2004
- --- a b: 1a 2
2005
- --- ```
2006
- ---
2007
- --- Arguments without the `=<value>` parts are treated as boolean arguments. `POST /test` with the request body `foo&bar` will yield:
2008
- ---
2009
- --- ```bash
2010
- --- foo: true
2011
- --- bar: true
2012
- --- ```
2013
- ---
2014
- --- That is, they will take Lua boolean values `true`. However, they are different from arguments taking empty string values. `POST /test` with request body `foo=&bar=` will return something like
2015
- ---
2016
- --- ```bash
2017
- --- foo:
2018
- --- bar:
2019
- --- ```
2020
- ---
2021
- --- Empty key arguments are discarded. `POST /test` with body `=hello&=world` will yield empty outputs for instance.
2022
- ---
2023
- --- Note that a maximum of 100 request arguments are parsed by default (including those with the same name) and that additional request arguments are silently discarded to guard against potential denial of service attacks. When the limit is exceeded, it will return a second value which is the string `"truncated"`.
2024
- ---
2025
- --- However, the optional `max_args` function argument can be used to override this limit:
2026
- ---
2027
- --- ```lua
2028
- --- local args, err = ngx.req.get_post_args(10)
2029
- --- if err == "truncated" then
2030
- --- -- one can choose to ignore or reject the current request here
2031
- --- end
2032
- --- ```
2033
- ---
2034
- --- This argument can be set to zero to remove the limit and to process all request arguments received:
2035
- ---
2036
- --- ```lua
2037
- --- local args, err = ngx.req.get_post_args(0)
2038
- --- ```
2039
- ---
2040
- --- Removing the `max_args` cap is strongly discouraged.
2041
- ---
2042
- ---@param max_args? number
2043
- ---@return table args
2044
- ---@return string|'"truncated"' error
2045
- function ngx.req.get_post_args(max_args) end
2046
-
2047
- --- Returns a Lua table holding all the current request URL query arguments. An optional `tab` argument can be used to reuse the table returned by this method.
2048
- ---
2049
- --- ```nginx
2050
- --- location = /test {
2051
- --- content_by_lua_block {
2052
- --- local args, err = ngx.req.get_uri_args()
2053
- ---
2054
- --- if err == "truncated" then
2055
- --- -- one can choose to ignore or reject the current request here
2056
- --- end
2057
- ---
2058
- --- for key, val in pairs(args) do
2059
- --- if type(val) == "table" then
2060
- --- ngx.say(key, ": ", table.concat(val, ", "))
2061
- --- else
2062
- --- ngx.say(key, ": ", val)
2063
- --- end
2064
- --- end
2065
- --- }
2066
- --- }
2067
- --- ```
2068
- ---
2069
- --- Then `GET /test?foo=bar&bar=baz&bar=blah` will yield the response body
2070
- ---
2071
- --- ```bash
2072
- --- foo: bar
2073
- --- bar: baz, blah
2074
- --- ```
2075
- ---
2076
- --- Multiple occurrences of an argument key will result in a table value holding all the values for that key in order.
2077
- ---
2078
- --- Keys and values are unescaped according to URI escaping rules. In the settings above, `GET /test?a%20b=1%61+2` will yield:
2079
- ---
2080
- --- ```bash
2081
- --- a b: 1a 2
2082
- --- ```
2083
- ---
2084
- --- Arguments without the `=<value>` parts are treated as boolean arguments. `GET /test?foo&bar` will yield:
2085
- ---
2086
- --- ```bash
2087
- --- foo: true
2088
- --- bar: true
2089
- --- ```
2090
- ---
2091
- --- That is, they will take Lua boolean values `true`. However, they are different from arguments taking empty string values. `GET /test?foo=&bar=` will give something like
2092
- ---
2093
- --- ```bash
2094
- --- foo:
2095
- --- bar:
2096
- --- ```
2097
- ---
2098
- --- Empty key arguments are discarded. `GET /test?=hello&=world` will yield an empty output for instance.
2099
- ---
2100
- --- Updating query arguments via the NGINX variable `$args` (or `ngx.var.args` in Lua) at runtime is also supported:
2101
- ---
2102
- --- ```lua
2103
- --- ngx.var.args = "a=3&b=42"
2104
- --- local args, err = ngx.req.get_uri_args()
2105
- --- ```
2106
- ---
2107
- --- Here the `args` table will always look like
2108
- ---
2109
- --- ```lua
2110
- --- {a = 3, b = 42}
2111
- --- ```
2112
- ---
2113
- --- regardless of the actual request query string.
2114
- ---
2115
- --- Note that a maximum of 100 request arguments are parsed by default (including those with the same name) and that additional request arguments are silently discarded to guard against potential denial of service attacks. When the limit is exceeded, it will return a second value which is the string `"truncated"`.
2116
- ---
2117
- --- However, the optional `max_args` function argument can be used to override this limit:
2118
- ---
2119
- --- ```lua
2120
- --- local args, err = ngx.req.get_uri_args(10)
2121
- --- if err == "truncated" then
2122
- --- -- one can choose to ignore or reject the current request here
2123
- --- end
2124
- --- ```
2125
- ---
2126
- --- This argument can be set to zero to remove the limit and to process all request arguments received:
2127
- ---
2128
- --- ```lua
2129
- --- local args, err = ngx.req.get_uri_args(0)
2130
- --- ```
2131
- ---
2132
- --- Removing the `max_args` cap is strongly discouraged.
2133
- ---
2134
- ---@param max_args? number
2135
- ---@param tab? table
2136
- ---@return table args
2137
- ---@return string|'"truncated"' error
2138
- function ngx.req.get_uri_args(max_args, tab) end
2139
-
2140
- --- Rewrite the current request's (parsed) URI by the `uri` argument. The `uri` argument must be a Lua string and cannot be of zero length, or a Lua exception will be thrown.
2141
- ---
2142
- --- The optional boolean `jump` argument can trigger location rematch (or location jump) as `ngx_http_rewrite_module`'s `rewrite` directive, that is, when `jump` is `true` (default to `false`), this function will never return and it will tell NGINX to try re-searching locations with the new URI value at the later `post-rewrite` phase and jumping to the new location.
2143
- ---
2144
- --- Location jump will not be triggered otherwise, and only the current request's URI will be modified, which is also the default behavior. This function will return but with no returned values when the `jump` argument is `false` or absent altogether.
2145
- ---
2146
- --- For example, the following NGINX config snippet
2147
- ---
2148
- --- ```nginx
2149
- --- rewrite ^ /foo last;
2150
- --- ```
2151
- ---
2152
- --- can be coded in Lua like this:
2153
- ---
2154
- --- ```lua
2155
- --- ngx.req.set_uri("/foo", true)
2156
- --- ```
2157
- ---
2158
- --- Similarly, NGINX config
2159
- ---
2160
- --- ```nginx
2161
- --- rewrite ^ /foo break;
2162
- --- ```
2163
- ---
2164
- --- can be coded in Lua as
2165
- ---
2166
- --- ```lua
2167
- --- ngx.req.set_uri("/foo", false)
2168
- --- ```
2169
- ---
2170
- --- or equivalently,
2171
- ---
2172
- --- ```lua
2173
- --- ngx.req.set_uri("/foo")
2174
- --- ```
2175
- ---
2176
- --- The `jump` argument can only be set to `true` in `rewrite_by_lua*`. Use of jump in other contexts is prohibited and will throw out a Lua exception.
2177
- ---
2178
- --- A more sophisticated example involving regex substitutions is as follows
2179
- ---
2180
- --- ```nginx
2181
- --- location /test {
2182
- --- rewrite_by_lua_block {
2183
- --- local uri = ngx.re.sub(ngx.var.uri, "^/test/(.*)", "/$1", "o")
2184
- --- ngx.req.set_uri(uri)
2185
- --- }
2186
- --- proxy_pass http://my_backend;
2187
- --- }
2188
- --- ```
2189
- ---
2190
- --- which is functionally equivalent to
2191
- ---
2192
- --- ```nginx
2193
- --- location /test {
2194
- --- rewrite ^/test/(.*) /$1 break;
2195
- --- proxy_pass http://my_backend;
2196
- --- }
2197
- --- ```
2198
- ---
2199
- --- Note: this function throws a Lua error if the `uri` argument
2200
- --- contains unsafe characters (control characters).
2201
- ---
2202
- --- Note that it is not possible to use this interface to rewrite URI arguments and that `ngx.req.set_uri_args` should be used for this instead. For instance, NGINX config
2203
- ---
2204
- --- ```nginx
2205
- --- rewrite ^ /foo?a=3? last;
2206
- --- ```
2207
- ---
2208
- --- can be coded as
2209
- ---
2210
- --- ```nginx
2211
- --- ngx.req.set_uri_args("a=3")
2212
- --- ngx.req.set_uri("/foo", true)
2213
- --- ```
2214
- ---
2215
- --- or
2216
- ---
2217
- --- ```nginx
2218
- --- ngx.req.set_uri_args({a = 3})
2219
- --- ngx.req.set_uri("/foo", true)
2220
- --- ```
2221
- ---
2222
- --- An optional boolean `binary` argument allows arbitrary binary URI data. By default, this `binary` argument is false and this function will throw out a Lua error such as the one below when the `uri` argument contains any control characters (ASCII Code 0 ~ 0x08, 0x0A ~ 0x1F and 0x7F).
2223
- ---
2224
- --- [error] 23430#23430: *1 lua entry thread aborted: runtime error:
2225
- --- content_by_lua(nginx.conf:44):3: ngx.req.set_uri unsafe byte "0x00"
2226
- --- in "\x00foo" (maybe you want to set the 'binary' argument?)
2227
- ---
2228
- ---@param uri string
2229
- ---@param jump? boolean
2230
- ---@param binary? boolean
2231
- function ngx.req.set_uri(uri, jump, binary) end
2232
-
2233
- --- Append new data chunk specified by the `data_chunk` argument onto the existing request body created by the `ngx.req.init_body` call.
2234
- ---
2235
- --- When the data can no longer be hold in the memory buffer for the request body, then the data will be flushed onto a temporary file just like the standard request body reader in the NGINX core.
2236
- ---
2237
- --- It is important to always call the `ngx.req.finish_body` after all the data has been appended onto the current request body.
2238
- ---
2239
- --- This function can be used with `ngx.req.init_body`, `ngx.req.finish_body`, and `ngx.req.socket` to implement efficient input filters in pure Lua (in the context of `rewrite_by_lua*` or `access_by_lua*`), which can be used with other NGINX content handler or upstream modules like `ngx_http_proxy_module` and `ngx_http_fastcgi_module`.
2240
- ---
2241
- ---@param data_chunk any
2242
- function ngx.req.append_body(data_chunk) end
2243
-
2244
- --- Overrides the current request's request method with the `method_id` argument. Currently only numerical `method constants` are supported, like `ngx.HTTP_POST` and `ngx.HTTP_GET`.
2245
- ---
2246
- --- If the current request is an NGINX subrequest, then the subrequest's method will be overridden.
2247
- ---
2248
- ---@param method_id ngx.http.method
2249
- function ngx.req.set_method(method_id) end
2250
-
2251
- --- Retrieves the current request's request method name. Strings like `"GET"` and `"POST"` are returned instead of numerical `method constants`.
2252
- ---
2253
- --- If the current request is an NGINX subrequest, then the subrequest's method name will be returned.
2254
- ---
2255
- ---@return string
2256
- function ngx.req.get_method() end
2257
-
2258
- --- Returns a read-only cosocket object that wraps the downstream connection. Only `receive` and `receiveuntil` methods are supported on this object.
2259
- ---
2260
- --- In case of error, `nil` will be returned as well as a string describing the error.
2261
- ---
2262
- --- The socket object returned by this method is usually used to read the current request's body in a streaming fashion. Do not turn on the `lua_need_request_body` directive, and do not mix this call with `ngx.req.read_body` and `ngx.req.discard_body`.
2263
- ---
2264
- --- If any request body data has been pre-read into the NGINX core request header buffer, the resulting cosocket object will take care of this to avoid potential data loss resulting from such pre-reading.
2265
- --- Chunked request bodies are not yet supported in this API.
2266
- ---
2267
- --- An optional boolean `raw` argument can be provided. When this argument is `true`, this function returns a full-duplex cosocket object wrapping around the raw downstream connection socket, upon which you can call the `receive`, `receiveuntil`, and `send` methods.
2268
- ---
2269
- --- When the `raw` argument is `true`, it is required that no pending data from any previous `ngx.say`, `ngx.print`, or `ngx.send_headers` calls exists. So if you have these downstream output calls previously, you should call `ngx.flush(true)` before calling `ngx.req.socket(true)` to ensure that there is no pending output data. If the request body has not been read yet, then this "raw socket" can also be used to read the request body.
2270
- ---
2271
- --- You can use the "raw request socket" returned by `ngx.req.socket(true)` to implement fancy protocols like `WebSocket`, or just emit your own raw HTTP response header or body data. You can refer to the `lua-resty-websocket library` for a real world example.
2272
- ---
2273
- ---@param raw? boolean
2274
- ---@return tcpsock? socket
2275
- ---@return string? error
2276
- function ngx.req.socket(raw) end
2277
-
2278
- --- Completes the construction process of the new request body created by the `ngx.req.init_body` and `ngx.req.append_body` calls.
2279
- ---
2280
- --- This function can be used with `ngx.req.init_body`, `ngx.req.append_body`, and `ngx.req.socket` to implement efficient input filters in pure Lua (in the context of `rewrite_by_lua*` or `access_by_lua*`), which can be used with other NGINX content handler or upstream modules like `ngx_http_proxy_module` and `ngx_http_fastcgi_module`.
2281
- ---
2282
- function ngx.req.finish_body() end
2283
-
2284
- --- Returns the original raw HTTP protocol header received by the NGINX server.
2285
- ---
2286
- --- By default, the request line and trailing `CR LF` terminator will also be included. For example,
2287
- ---
2288
- --- ```lua
2289
- --- ngx.print(ngx.req.raw_header())
2290
- --- ```
2291
- ---
2292
- --- gives something like this:
2293
- ---
2294
- --- GET /t HTTP/1.1
2295
- --- Host: localhost
2296
- --- Connection: close
2297
- --- Foo: bar
2298
- ---
2299
- --- You can specify the optional
2300
- --- `no_request_line` argument as a `true` value to exclude the request line from the result. For example,
2301
- ---
2302
- --- ```lua
2303
- --- ngx.print(ngx.req.raw_header(true))
2304
- --- ```
2305
- ---
2306
- --- outputs something like this:
2307
- ---
2308
- --- Host: localhost
2309
- --- Connection: close
2310
- --- Foo: bar
2311
- ---
2312
- --- This method does not work in HTTP/2 requests yet.
2313
- ---
2314
- ---@param no_request_line? boolean
2315
- ---@return string
2316
- function ngx.req.raw_header(no_request_line) end
2317
-
2318
- --- Returns a floating-point number representing the timestamp (including milliseconds as the decimal part) when the current request was created.
2319
- ---
2320
- --- The following example emulates the `$request_time` variable value (provided by `ngx_http_log_module`) in pure Lua:
2321
- ---
2322
- --- ```lua
2323
- --- local request_time = ngx.now() - ngx.req.start_time()
2324
- --- ```
2325
- ---
2326
- ---@return number
2327
- function ngx.req.start_time() end
2328
-
2329
- --- Creates a new blank request body for the current request and inializes the buffer for later request body data writing via the `ngx.req.append_body` and `ngx.req.finish_body` APIs.
2330
- ---
2331
- --- If the `buffer_size` argument is specified, then its value will be used for the size of the memory buffer for body writing with `ngx.req.append_body`. If the argument is omitted, then the value specified by the standard `client_body_buffer_size` directive will be used instead.
2332
- ---
2333
- --- When the data can no longer be hold in the memory buffer for the request body, then the data will be flushed onto a temporary file just like the standard request body reader in the NGINX core.
2334
- ---
2335
- --- It is important to always call the `ngx.req.finish_body` after all the data has been appended onto the current request body. Also, when this function is used together with `ngx.req.socket`, it is required to call `ngx.req.socket` *before* this function, or you will get the "request body already exists" error message.
2336
- ---
2337
- --- The usage of this function is often like this:
2338
- ---
2339
- --- ```lua
2340
- --- ngx.req.init_body(128 * 1024) -- buffer is 128KB
2341
- --- for chunk in next_data_chunk() do
2342
- --- ngx.req.append_body(chunk) -- each chunk can be 4KB
2343
- --- end
2344
- --- ngx.req.finish_body()
2345
- --- ```
2346
- ---
2347
- --- This function can be used with `ngx.req.append_body`, `ngx.req.finish_body`, and `ngx.req.socket` to implement efficient input filters in pure Lua (in the context of `rewrite_by_lua*` or `access_by_lua*`), which can be used with other NGINX content handler or upstream modules like `ngx_http_proxy_module` and `ngx_http_fastcgi_module`.
2348
- ---
2349
- ---@param buffer_size? number
2350
- function ngx.req.init_body(buffer_size) end
2351
-
2352
- --- Set the current request's request body using the in-file data specified by the `file_name` argument.
2353
- ---
2354
- --- If the request body has not been read yet, call `ngx.req.read_body` first (or turn on `lua_need_request_body` to force this module to read the request body. This is not recommended however). Additionally, the request body must not have been previously discarded by `ngx.req.discard_body`.
2355
- ---
2356
- --- If the optional `auto_clean` argument is given a `true` value, then this file will be removed at request completion or the next time this function or `ngx.req.set_body_data` are called in the same request. The `auto_clean` is default to `false`.
2357
- ---
2358
- --- Please ensure that the file specified by the `file_name` argument exists and is readable by an NGINX worker process by setting its permission properly to avoid Lua exception errors.
2359
- ---
2360
- --- Whether the previous request body has been read into memory or buffered into a disk file, it will be freed or the disk file will be cleaned up immediately, respectively.
2361
- ---
2362
- ---@param file_name string
2363
- ---@param auto_clean? boolean
2364
- function ngx.req.set_body_file(file_name, auto_clean) end
2365
-
2366
- --- Clears the current request's request header named `header_name`. None of the current request's existing subrequests will be affected but subsequently initiated subrequests will inherit the change by default.
2367
- ---
2368
- ---@param header_name string
2369
- function ngx.req.clear_header(header_name) end
2370
-
2371
- --- Returns a Lua table holding all the current request headers.
2372
- ---
2373
- --- ```lua
2374
- --- local h, err = ngx.req.get_headers()
2375
- ---
2376
- --- if err == "truncated" then
2377
- --- -- one can choose to ignore or reject the current request here
2378
- --- end
2379
- ---
2380
- --- for k, v in pairs(h) do
2381
- --- ...
2382
- --- end
2383
- --- ```
2384
- ---
2385
- --- To read an individual header:
2386
- ---
2387
- --- ```lua
2388
- --- ngx.say("Host: ", ngx.req.get_headers()["Host"])
2389
- --- ```
2390
- ---
2391
- --- Note that the `ngx.var.HEADER` API call, which uses core `$http_HEADER` variables, may be more preferable for reading individual request headers.
2392
- ---
2393
- --- For multiple instances of request headers such as:
2394
- ---
2395
- --- ```bash
2396
- --- Foo: foo
2397
- --- Foo: bar
2398
- --- Foo: baz
2399
- --- ```
2400
- ---
2401
- --- the value of `ngx.req.get_headers()["Foo"]` will be a Lua (array) table such as:
2402
- ---
2403
- --- ```lua
2404
- --- {"foo", "bar", "baz"}
2405
- --- ```
2406
- ---
2407
- --- Note that a maximum of 100 request headers are parsed by default (including those with the same name) and that additional request headers are silently discarded to guard against potential denial of service attacks. When the limit is exceeded, it will return a second value which is the string `"truncated"`.
2408
- ---
2409
- --- However, the optional `max_headers` function argument can be used to override this limit:
2410
- ---
2411
- --- ```lua
2412
- --- local headers, err = ngx.req.get_headers(10)
2413
- ---
2414
- --- if err == "truncated" then
2415
- --- -- one can choose to ignore or reject the current request here
2416
- --- end
2417
- --- ```
2418
- ---
2419
- --- This argument can be set to zero to remove the limit and to process all request headers received:
2420
- ---
2421
- --- ```lua
2422
- --- local headers, err = ngx.req.get_headers(0)
2423
- --- ```
2424
- ---
2425
- --- Removing the `max_headers` cap is strongly discouraged.
2426
- ---
2427
- --- All the header names in the Lua table returned are converted to the pure lower-case form by default, unless the `raw` argument is set to `true` (default to `false`).
2428
- ---
2429
- --- Also, by default, an `__index` metamethod is added to the resulting Lua table and will normalize the keys to a pure lowercase form with all underscores converted to dashes in case of a lookup miss. For example, if a request header `My-Foo-Header` is present, then the following invocations will all pick up the value of this header correctly:
2430
- ---
2431
- --- ```lua
2432
- --- ngx.say(headers.my_foo_header)
2433
- --- ngx.say(headers["My-Foo-Header"])
2434
- --- ngx.say(headers["my-foo-header"])
2435
- --- ```
2436
- ---
2437
- --- The `__index` metamethod will not be added when the `raw` argument is set to `true`.
2438
- ---
2439
- ---@param max_headers? number
2440
- ---@param raw? boolean
2441
- ---@return table<string, string|string[]> headers
2442
- ---@return string|'"truncated"' error
2443
- function ngx.req.get_headers(max_headers, raw) end
2444
-
2445
- --- Explicitly discard the request body, i.e., read the data on the connection and throw it away immediately (without using the request body by any means).
2446
- ---
2447
- --- This function is an asynchronous call and returns immediately.
2448
- ---
2449
- --- If the request body has already been read, this function does nothing and returns immediately.
2450
- ---
2451
- function ngx.req.discard_body() end
2452
-
2453
- --- Set the current request's request header named `header_name` to value `header_value`, overriding any existing ones.
2454
- ---
2455
- --- By default, all the subrequests subsequently initiated by `ngx.location.capture` and `ngx.location.capture_multi` will inherit the new header.
2456
- ---
2457
- --- Here is an example of setting the `Content-Type` header:
2458
- ---
2459
- --- ```lua
2460
- --- ngx.req.set_header("Content-Type", "text/css")
2461
- --- ```
2462
- ---
2463
- --- The `header_value` can take an array list of values,
2464
- --- for example,
2465
- ---
2466
- --- ```lua
2467
- --- ngx.req.set_header("Foo", {"a", "abc"})
2468
- --- ```
2469
- ---
2470
- --- will produce two new request headers:
2471
- ---
2472
- --- ```bash
2473
- --- Foo: a
2474
- --- Foo: abc
2475
- --- ```
2476
- ---
2477
- --- and old `Foo` headers will be overridden if there is any.
2478
- ---
2479
- --- When the `header_value` argument is `nil`, the request header will be removed. So
2480
- ---
2481
- --- ```lua
2482
- --- ngx.req.set_header("X-Foo", nil)
2483
- --- ```
2484
- ---
2485
- --- is equivalent to
2486
- ---
2487
- --- ```lua
2488
- --- ngx.req.clear_header("X-Foo")
2489
- --- ```
2490
- ---
2491
- ---@param header_name string
2492
- ---@param header_value string|string[]|nil
2493
- function ngx.req.set_header(header_name, header_value) end
2494
-
2495
- --- Retrieves in-memory request body data. It returns a Lua string rather than a Lua table holding all the parsed query arguments. Use the `ngx.req.get_post_args` function instead if a Lua table is required.
2496
- ---
2497
- --- This function returns `nil` if
2498
- ---
2499
- --- 1. the request body has not been read,
2500
- --- 1. the request body has been read into disk temporary files,
2501
- --- 1. or the request body has zero size.
2502
- ---
2503
- --- If the request body has not been read yet, call `ngx.req.read_body` first (or turn on `lua_need_request_body` to force this module to read the request body. This is not recommended however).
2504
- ---
2505
- --- If the request body has been read into disk files, try calling the `ngx.req.get_body_file` function instead.
2506
- ---
2507
- --- To force in-memory request bodies, try setting `client_body_buffer_size` to the same size value in `client_max_body_size`.
2508
- ---
2509
- --- Note that calling this function instead of using `ngx.var.request_body` or `ngx.var.echo_request_body` is more efficient because it can save one dynamic memory allocation and one data copy.
2510
- ---
2511
- ---@return string?
2512
- function ngx.req.get_body_data() end
2513
-
2514
- --- Reads the client request body synchronously without blocking the NGINX event loop.
2515
- ---
2516
- --- ```lua
2517
- --- ngx.req.read_body()
2518
- --- local args = ngx.req.get_post_args()
2519
- --- ```
2520
- ---
2521
- --- If the request body is already read previously by turning on `lua_need_request_body` or by using other modules, then this function does not run and returns immediately.
2522
- ---
2523
- --- If the request body has already been explicitly discarded, either by the `ngx.req.discard_body` function or other modules, this function does not run and returns immediately.
2524
- ---
2525
- --- In case of errors, such as connection errors while reading the data, this method will throw out a Lua exception *or* terminate the current request with a 500 status code immediately.
2526
- ---
2527
- --- The request body data read using this function can be retrieved later via `ngx.req.get_body_data` or, alternatively, the temporary file name for the body data cached to disk using `ngx.req.get_body_file`. This depends on
2528
- ---
2529
- --- 1. whether the current request body is already larger than the `client_body_buffer_size`,
2530
- --- 1. and whether `client_body_in_file_only` has been switched on.
2531
- ---
2532
- --- In cases where current request may have a request body and the request body data is not required, The `ngx.req.discard_body` function must be used to explicitly discard the request body to avoid breaking things under HTTP 1.1 keepalive or HTTP 1.1 pipelining.
2533
- ---
2534
- function ngx.req.read_body() end
2535
-
2536
- --- Retrieves the file name for the in-file request body data. Returns `nil` if the request body has not been read or has been read into memory.
2537
- ---
2538
- --- The returned file is read only and is usually cleaned up by NGINX's memory pool. It should not be manually modified, renamed, or removed in Lua code.
2539
- ---
2540
- --- If the request body has not been read yet, call `ngx.req.read_body` first (or turn on `lua_need_request_body` to force this module to read the request body. This is not recommended however).
2541
- ---
2542
- --- If the request body has been read into memory, try calling the `ngx.req.get_body_data` function instead.
2543
- ---
2544
- --- To force in-file request bodies, try turning on `client_body_in_file_only`.
2545
- ---
2546
- ---@return string? filename
2547
- function ngx.req.get_body_file() end
2548
-
2549
- --- Rewrite the current request's URI query arguments by the `args` argument. The `args` argument can be either a Lua string, as in
2550
- ---
2551
- --- ```lua
2552
- --- ngx.req.set_uri_args("a=3&b=hello%20world")
2553
- --- ```
2554
- ---
2555
- --- or a Lua table holding the query arguments' key-value pairs, as in
2556
- ---
2557
- --- ```lua
2558
- --- ngx.req.set_uri_args({ a = 3, b = "hello world" })
2559
- --- ```
2560
- ---
2561
- --- where in the latter case, this method will escape argument keys and values according to the URI escaping rule.
2562
- ---
2563
- --- Multi-value arguments are also supported:
2564
- ---
2565
- --- ```lua
2566
- --- ngx.req.set_uri_args({ a = 3, b = {5, 6} })
2567
- --- ```
2568
- ---
2569
- --- which will result in a query string like `a=3&b=5&b=6`.
2570
- ---
2571
- ---@param args string|table
2572
- function ngx.req.set_uri_args(args) end
2573
-
2574
- --- Encode the Lua table to a query args string according to the URI encoded rules.
2575
- ---
2576
- --- For example,
2577
- ---
2578
- --- ```lua
2579
- --- ngx.encode_args({foo = 3, ["b r"] = "hello world"})
2580
- --- ```
2581
- ---
2582
- --- yields
2583
- ---
2584
- --- foo=3&b%20r=hello%20world
2585
- ---
2586
- --- The table keys must be Lua strings.
2587
- ---
2588
- --- Multi-value query args are also supported. Just use a Lua table for the argument's value, for example:
2589
- ---
2590
- --- ```lua
2591
- --- ngx.encode_args({baz = {32, "hello"}})
2592
- --- ```
2593
- ---
2594
- --- gives
2595
- ---
2596
- --- baz=32&baz=hello
2597
- ---
2598
- --- If the value table is empty and the effect is equivalent to the `nil` value.
2599
- ---
2600
- --- Boolean argument values are also supported, for instance,
2601
- ---
2602
- --- ```lua
2603
- --- ngx.encode_args({a = true, b = 1})
2604
- --- ```
2605
- ---
2606
- --- yields
2607
- ---
2608
- --- a&b=1
2609
- ---
2610
- --- If the argument value is `false`, then the effect is equivalent to the `nil` value.
2611
- ---
2612
- ---@param args table
2613
- ---@return string encoded
2614
- function ngx.encode_args(args) end
2615
-
2616
- --- Decodes a URI encoded query-string into a Lua table. This is the inverse function of `ngx.encode_args`.
2617
- ---
2618
- --- The optional `max_args` argument can be used to specify the maximum number of arguments parsed from the `str` argument. By default, a maximum of 100 request arguments are parsed (including those with the same name) and that additional URI arguments are silently discarded to guard against potential denial of service attacks. When the limit is exceeded, it will return a second value which is the string `"truncated"`.
2619
- ---
2620
- --- This argument can be set to zero to remove the limit and to process all request arguments received:
2621
- ---
2622
- --- ```lua
2623
- --- local args = ngx.decode_args(str, 0)
2624
- --- ```
2625
- ---
2626
- --- Removing the `max_args` cap is strongly discouraged.
2627
- ---
2628
- ---@param str string
2629
- ---@param max_args? number
2630
- ---@return table args
2631
- ---@return string|'"truncated"' error
2632
- function ngx.decode_args(str, max_args) end
2633
-
2634
- ngx.socket = {}
2635
-
2636
- ---@class udpsock
2637
- local udpsock = {}
2638
-
2639
- --- Attempts to connect a UDP socket object to a remote server or to a datagram unix domain socket file. Because the datagram protocol is actually connection-less, this method does not really establish a "connection", but only just set the name of the remote peer for subsequent read/write operations.
2640
- ---
2641
- --- Both IP addresses and domain names can be specified as the `host` argument. In case of domain names, this method will use NGINX core's dynamic resolver to parse the domain name without blocking and it is required to configure the `resolver` directive in the `nginx.conf` file like this:
2642
- ---
2643
- --- ```nginx
2644
- --- resolver 8.8.8.8; # use Google's public DNS nameserver
2645
- --- ```
2646
- ---
2647
- --- If the nameserver returns multiple IP addresses for the host name, this method will pick up one randomly.
2648
- ---
2649
- --- In case of error, the method returns `nil` followed by a string describing the error. In case of success, the method returns `1`.
2650
- ---
2651
- --- Here is an example for connecting to a UDP (memcached) server:
2652
- ---
2653
- --- ```nginx
2654
- --- location /test {
2655
- --- resolver 8.8.8.8;
2656
- ---
2657
- --- content_by_lua_block {
2658
- --- local sock = ngx.socket.udp()
2659
- --- local ok, err = sock:setpeername("my.memcached.server.domain", 11211)
2660
- --- if not ok then
2661
- --- ngx.say("failed to connect to memcached: ", err)
2662
- --- return
2663
- --- end
2664
- --- ngx.say("successfully connected to memcached!")
2665
- --- sock:close()
2666
- --- }
2667
- --- }
2668
- --- ```
2669
- ---
2670
- --- Connecting to a datagram unix domain socket file is also possible on Linux:
2671
- ---
2672
- --- ```lua
2673
- --- local sock = ngx.socket.udp()
2674
- --- local ok, err = sock:setpeername("unix:/tmp/some-datagram-service.sock")
2675
- --- if not ok then
2676
- --- ngx.say("failed to connect to the datagram unix domain socket: ", err)
2677
- --- return
2678
- --- end
2679
- --- ```
2680
- ---
2681
- --- assuming the datagram service is listening on the unix domain socket file `/tmp/some-datagram-service.sock` and the client socket will use the "autobind" feature on Linux.
2682
- ---
2683
- --- Calling this method on an already connected socket object will cause the original connection to be closed first.
2684
- ---
2685
- ---@param host string
2686
- ---@param port number
2687
- ---@return boolean ok
2688
- ---@return string? error
2689
- ---@overload fun(self:udpsock, unix_socket:string):boolean, string?
2690
- function udpsock:setpeername(host, port) end
2691
-
2692
- --- Sends data on the current UDP or datagram unix domain socket object.
2693
- ---
2694
- --- In case of success, it returns `1`. Otherwise, it returns `nil` and a string describing the error.
2695
- ---
2696
- --- The input argument `data` can either be a Lua string or a (nested) Lua table holding string fragments. In case of table arguments, this method will copy all the string elements piece by piece to the underlying NGINX socket send buffers, which is usually optimal than doing string concatenation operations on the Lua land.
2697
- ---
2698
- ---@param data string | string[]
2699
- ---@return boolean ok
2700
- ---@return string? error
2701
- function udpsock:send(data) end
2702
-
2703
- --- Receives data from the UDP or datagram unix domain socket object with an optional receive buffer size argument, `size`.
2704
- ---
2705
- --- This method is a synchronous operation and is 100% nonblocking.
2706
- ---
2707
- --- In case of success, it returns the data received; in case of error, it returns `nil` with a string describing the error.
2708
- ---
2709
- --- If the `size` argument is specified, then this method will use this size as the receive buffer size. But when this size is greater than `8192`, then `8192` will be used instead.
2710
- ---
2711
- --- If no argument is specified, then the maximal buffer size, `8192` is assumed.
2712
- ---
2713
- --- Timeout for the reading operation is controlled by the `lua_socket_read_timeout` config directive and the `settimeout` method. And the latter takes priority. For example:
2714
- ---
2715
- --- ```lua
2716
- --- sock:settimeout(1000) -- one second timeout
2717
- --- local data, err = sock:receive()
2718
- --- if not data then
2719
- --- ngx.say("failed to read a packet: ", err)
2720
- --- return
2721
- --- end
2722
- --- ngx.say("successfully read a packet: ", data)
2723
- --- ```
2724
- ---
2725
- --- It is important here to call the `settimeout` method *before* calling this method.
2726
- ---
2727
- ---@param size? number
2728
- ---@return string? data
2729
- ---@return string? error
2730
- function udpsock:receive(size) end
2731
-
2732
- --- Closes the current UDP or datagram unix domain socket. It returns the `1` in case of success and returns `nil` with a string describing the error otherwise.
2733
- ---
2734
- --- Socket objects that have not invoked this method (and associated connections) will be closed when the socket object is released by the Lua GC (Garbage Collector) or the current client HTTP request finishes processing.
2735
- ---
2736
- ---@return boolean ok
2737
- ---@return string? error
2738
- function udpsock:close() end
2739
-
2740
- --- Set the timeout value in milliseconds for subsequent socket operations (like `receive`).
2741
- ---
2742
- --- Settings done by this method takes priority over those config directives, like `lua_socket_read_timeout`.
2743
- ---
2744
- ---@param time number
2745
- function udpsock:settimeout(time) end
2746
-
2747
- --- Creates and returns a TCP or stream-oriented unix domain socket object (also known as one type of the "cosocket" objects). The following methods are supported on this object:
2748
- ---
2749
- --- * `connect`
2750
- --- * `sslhandshake`
2751
- --- * `send`
2752
- --- * `receive`
2753
- --- * `close`
2754
- --- * `settimeout`
2755
- --- * `settimeouts`
2756
- --- * `setoption`
2757
- --- * `receiveany`
2758
- --- * `receiveuntil`
2759
- --- * `setkeepalive`
2760
- --- * `getreusedtimes`
2761
- ---
2762
- --- It is intended to be compatible with the TCP API of the `LuaSocket` library but is 100% nonblocking out of the box.
2763
- ---
2764
- --- The cosocket object created by this API function has exactly the same lifetime as the Lua handler creating it. So never pass the cosocket object to any other Lua handler (including ngx.timer callback functions) and never share the cosocket object between different NGINX requests.
2765
- ---
2766
- --- For every cosocket object's underlying connection, if you do not
2767
- --- explicitly close it (via `close`) or put it back to the connection
2768
- --- pool (via `setkeepalive`), then it is automatically closed when one of
2769
- --- the following two events happens:
2770
- ---
2771
- --- * the current request handler completes, or
2772
- --- * the Lua cosocket object value gets collected by the Lua GC.
2773
- ---
2774
- --- Fatal errors in cosocket operations always automatically close the current
2775
- --- connection (note that, read timeout error is the only error that is
2776
- --- not fatal), and if you call `close` on a closed connection, you will get
2777
- --- the "closed" error.
2778
- ---
2779
- --- The cosocket object here is full-duplex, that is, a reader "light thread" and a writer "light thread" can operate on a single cosocket object simultaneously (both "light threads" must belong to the same Lua handler though, see reasons above). But you cannot have two "light threads" both reading (or writing or connecting) the same cosocket, otherwise you might get an error like "socket busy reading" when calling the methods of the cosocket object.
2780
- ---
2781
- ---@return tcpsock
2782
- function ngx.socket.tcp() end
2783
-
2784
- ---@class tcpsock
2785
- local tcpsock = {}
2786
-
2787
- --- Attempts to connect a TCP socket object to a remote server or to a stream unix domain socket file without blocking.
2788
- ---
2789
- --- Before actually resolving the host name and connecting to the remote backend, this method will always look up the connection pool for matched idle connections created by previous calls of this method (or the `ngx.socket.connect` function).
2790
- ---
2791
- --- Both IP addresses and domain names can be specified as the `host` argument. In case of domain names, this method will use NGINX core's dynamic resolver to parse the domain name without blocking and it is required to configure the `resolver` directive in the `nginx.conf` file like this:
2792
- ---
2793
- --- ```nginx
2794
- --- resolver 8.8.8.8; # use Google's public DNS nameserver
2795
- --- ```
2796
- ---
2797
- --- If the nameserver returns multiple IP addresses for the host name, this method will pick up one randomly.
2798
- ---
2799
- --- In case of error, the method returns `nil` followed by a string describing the error. In case of success, the method returns `1`.
2800
- ---
2801
- --- Here is an example for connecting to a TCP server:
2802
- ---
2803
- --- ```nginx
2804
- --- location /test {
2805
- --- resolver 8.8.8.8;
2806
- ---
2807
- --- content_by_lua_block {
2808
- --- local sock = ngx.socket.tcp()
2809
- --- local ok, err = sock:connect("www.google.com", 80)
2810
- --- if not ok then
2811
- --- ngx.say("failed to connect to google: ", err)
2812
- --- return
2813
- --- end
2814
- --- ngx.say("successfully connected to google!")
2815
- --- sock:close()
2816
- --- }
2817
- --- }
2818
- --- ```
2819
- ---
2820
- --- Connecting to a Unix Domain Socket file is also possible:
2821
- ---
2822
- --- ```lua
2823
- --- local sock = ngx.socket.tcp()
2824
- --- local ok, err = sock:connect("unix:/tmp/memcached.sock")
2825
- --- if not ok then
2826
- --- ngx.say("failed to connect to the memcached unix domain socket: ", err)
2827
- --- return
2828
- --- end
2829
- --- ```
2830
- ---
2831
- --- assuming memcached (or something else) is listening on the unix domain socket file `/tmp/memcached.sock`.
2832
- ---
2833
- --- Timeout for the connecting operation is controlled by the `lua_socket_connect_timeout` config directive and the `settimeout` method. And the latter takes priority. For example:
2834
- ---
2835
- --- ```lua
2836
- --- local sock = ngx.socket.tcp()
2837
- --- sock:settimeout(1000) -- one second timeout
2838
- --- local ok, err = sock:connect(host, port)
2839
- --- ```
2840
- ---
2841
- --- It is important here to call the `settimeout` method *before* calling this method.
2842
- ---
2843
- --- Calling this method on an already connected socket object will cause the original connection to be closed first.
2844
- ---
2845
- ---@param host string
2846
- ---@param port number
2847
- ---@param opts? tcpsock.connect.opts
2848
- ---@return boolean ok
2849
- ---@return string? error
2850
- ---@overload fun(self:tcpsock, unix_socket:string, opts?:tcpsock.connect.opts):boolean, string?
2851
- function tcpsock:connect(host, port, opts) end
2852
-
2853
- --- An optional Lua table can be specified as the last argument to `tcpsock:connect()`
2854
- ---
2855
- ---@class tcpsock.connect.opts : table
2856
- ---
2857
- --- A custom name for the connection pool being used. If omitted, then the connection pool name will be generated from the string template `"<host>:<port>"` or `"<unix-socket-path>"`.
2858
- ---@field pool string
2859
- ---
2860
- --- The size of the connection pool. If omitted and no `backlog` option was provided, no pool will be created. If omitted but `backlog` was provided, the pool will be created with a default size equal to the value of the `lua_socket_pool_size` directive. The connection pool holds up to `pool_size` alive connections ready to be reused by subsequent calls to `connect`, but note that there is no upper limit to the total number of opened connections outside of the pool. If you need to restrict the total number of opened connections, specify the `backlog` option. When the connection pool would exceed its size limit, the least recently used (kept-alive) connection already in the pool will be closed to make room for the current connection. Note that the cosocket connection pool is per NGINX worker process rather than per NGINX server instance, so the size limit specified here also applies to every single NGINX worker process. Also note that the size of the connection pool cannot be changed once it has been created.
2861
- ---@field pool_size number
2862
- ---
2863
- --- Limits the total number of opened connections for this pool. No more connections than `pool_size` can be opened for this pool at any time. If the connection pool is full, subsequent connect operations will be queued into a queue equal to this option's value (the "backlog" queue). If the number of queued connect operations is equal to `backlog`, subsequent connect operations will fail and return `nil` plus the error string `"too many waiting connect operations"`. The queued connect operations will be resumed once the number of connections in the pool is less than `pool_size`. The queued connect operation will abort once they have been queued for more than `connect_timeout`, controlled by `settimeouts`, and will return `nil` plus the error string `"timeout"`.
2864
- ---@field backlog number
2865
-
2866
- --- Does SSL/TLS handshake on the currently established connection.
2867
- ---
2868
- --- The optional `reused_session` argument can take a former SSL
2869
- --- session userdata returned by a previous `sslhandshake`
2870
- --- call for exactly the same target. For short-lived connections, reusing SSL
2871
- --- sessions can usually speed up the handshake by one order by magnitude but it
2872
- --- is not so useful if the connection pool is enabled. This argument defaults to
2873
- --- `nil`. If this argument takes the boolean `false` value, no SSL session
2874
- --- userdata would return by this call and only a Lua boolean will be returned as
2875
- --- the first return value; otherwise the current SSL session will
2876
- --- always be returned as the first argument in case of successes.
2877
- ---
2878
- --- The optional `server_name` argument is used to specify the server
2879
- --- name for the new TLS extension Server Name Indication (SNI). Use of SNI can
2880
- --- make different servers share the same IP address on the server side. Also,
2881
- --- when SSL verification is enabled, this `server_name` argument is
2882
- --- also used to validate the server name specified in the server certificate sent from
2883
- --- the remote.
2884
- ---
2885
- --- The optional `ssl_verify` argument takes a Lua boolean value to
2886
- --- control whether to perform SSL verification. When set to `true`, the server
2887
- --- certificate will be verified according to the CA certificates specified by
2888
- --- the `lua_ssl_trusted_certificate` directive.
2889
- --- You may also need to adjust the `lua_ssl_verify_depth`
2890
- --- directive to control how deep we should follow along the certificate chain.
2891
- --- Also, when the `ssl_verify` argument is true and the
2892
- --- `server_name` argument is also specified, the latter will be used
2893
- --- to validate the server name in the server certificate.
2894
- ---
2895
- --- The optional `send_status_req` argument takes a boolean that controls whether to send
2896
- --- the OCSP status request in the SSL handshake request (which is for requesting OCSP stapling).
2897
- ---
2898
- --- For connections that have already done SSL/TLS handshake, this method returns
2899
- --- immediately.
2900
- ---
2901
- ---@param reused_session? userdata|boolean
2902
- ---@param server_name? string
2903
- ---@param ssl_verify? boolean
2904
- ---@param send_status_req? boolean
2905
- ---@return userdata|boolean session_or_ok
2906
- ---@return string? error
2907
- function tcpsock:sslhandshake(reused_session, server_name, ssl_verify, send_status_req) end
2908
-
2909
- --- Set client certificate chain and corresponding private key to the TCP socket object.
2910
- ---
2911
- --- The certificate chain and private key provided will be used later by the `tcpsock:sslhandshake` method.
2912
- ---
2913
- --- If both of `cert` and `pkey` are `nil`, this method will clear any existing client certificate and private key that was previously set on the cosocket object
2914
- ---
2915
- ---@param cert ffi.cdata*|nil # a client certificate chain cdata object that will be used while handshaking with remote server. These objects can be created using ngx.ssl.parse_pem_cert function provided by lua-resty-core. Note that specifying the cert option requires corresponding pkey be provided too.
2916
- ---@param key ffi.cdata*|nil # a private key corresponds to the cert option above. These objects can be created using ngx.ssl.parse_pem_priv_key function provided by lua-resty-core.
2917
- ---@return boolean ok
2918
- ---@return string? error
2919
- function tcpsock:setclientcert(cert, key) end
2920
-
2921
- --- Sends data without blocking on the current TCP or Unix Domain Socket connection.
2922
- ---
2923
- --- This method is a synchronous operation that will not return until *all* the data has been flushed into the system socket send buffer or an error occurs.
2924
- ---
2925
- --- In case of success, it returns the total number of bytes that have been sent. Otherwise, it returns `nil` and a string describing the error.
2926
- ---
2927
- --- The input argument `data` can either be a Lua string or a (nested) Lua table holding string fragments. In case of table arguments, this method will copy all the string elements piece by piece to the underlying NGINX socket send buffers, which is usually optimal than doing string concatenation operations on the Lua land.
2928
- ---
2929
- --- Timeout for the sending operation is controlled by the `lua_socket_send_timeout` config directive and the `settimeout` method. And the latter takes priority. For example:
2930
- ---
2931
- --- ```lua
2932
- --- sock:settimeout(1000) -- one second timeout
2933
- --- local bytes, err = sock:send(request)
2934
- --- ```
2935
- ---
2936
- --- It is important here to call the `settimeout` method *before* calling this method.
2937
- ---
2938
- --- In case of any connection errors, this method always automatically closes the current connection.
2939
- ---
2940
- ---@param data string|string[]
2941
- ---@return number? bytes
2942
- ---@return string? error
2943
- function tcpsock:send(data) end
2944
-
2945
- --- Receives data from the connected socket according to the reading pattern or size.
2946
- ---
2947
- --- This method is a synchronous operation just like the `send` method and is 100% nonblocking.
2948
- ---
2949
- --- In case of success, it returns the data received; in case of error, it returns `nil` with a string describing the error and the partial data received so far.
2950
- ---
2951
- --- If a non-number-like string argument is specified, then it is interpreted as a "pattern". The following patterns are supported:
2952
- ---
2953
- --- * `'*a'`: reads from the socket until the connection is closed. No end-of-line translation is performed;
2954
- --- * `'*l'`: reads a line of text from the socket. The line is terminated by a `Line Feed` (LF) character (ASCII 10), optionally preceded by a `Carriage Return` (CR) character (ASCII 13). The CR and LF characters are not included in the returned line. In fact, all CR characters are ignored by the pattern.
2955
- ---
2956
- --- If no argument is specified, then it is assumed to be the pattern `'*l'`, that is, the line reading pattern.
2957
- ---
2958
- --- If a number-like argument is specified (including strings that look like numbers), then it is interpreted as a size. This method will not return until it reads exactly this size of data or an error occurs.
2959
- ---
2960
- ---
2961
- --- Timeout for the reading operation is controlled by the `lua_socket_read_timeout` config directive and the `settimeout` method. And the latter takes priority. For example:
2962
- ---
2963
- --- ```lua
2964
- --- sock:settimeout(1000) -- one second timeout
2965
- --- local line, err, partial = sock:receive()
2966
- --- if not line then
2967
- --- ngx.say("failed to read a line: ", err)
2968
- --- return
2969
- --- end
2970
- --- ngx.say("successfully read a line: ", line)
2971
- --- ```
2972
- ---
2973
- --- It is important here to call the `settimeout` method *before* calling this method.
2974
- ---
2975
- --- This method does not automatically closes the current connection when the read timeout error happens. For other connection errors, this method always automatically closes the connection.
2976
- ---
2977
- ---@overload fun(self:tcpsock, size:number):string,string,string
2978
- ---
2979
- ---@param pattern? '"*a"'|'"*l"'
2980
- ---@return string? data
2981
- ---@return string? error
2982
- ---@return string? partial
2983
- function tcpsock:receive(pattern) end
2984
-
2985
- --- Returns any data received by the connected socket, at most `max` bytes.
2986
- ---
2987
- --- This method is a synchronous operation just like the `send` method and is 100% nonblocking.
2988
- ---
2989
- --- In case of success, it returns the data received; in case of error, it returns `nil` with a string describing the error.
2990
- ---
2991
- --- If the received data is more than this size, this method will return with exactly this size of data.
2992
- --- The remaining data in the underlying receive buffer could be returned in the next reading operation.
2993
- ---
2994
- --- Timeout for the reading operation is controlled by the `lua_socket_read_timeout` config directive and the `settimeouts` method. And the latter takes priority. For example:
2995
- ---
2996
- --- ```lua
2997
- --- sock:settimeouts(1000, 1000, 1000) -- one second timeout for connect/read/write
2998
- --- local data, err = sock:receiveany(10 * 1024) -- read any data, at most 10K
2999
- --- if not data then
3000
- --- ngx.say("failed to read any data: ", err)
3001
- --- return
3002
- --- end
3003
- --- ngx.say("successfully read: ", data)
3004
- --- ```
3005
- ---
3006
- --- This method doesn't automatically close the current connection when the read timeout error occurs. For other connection errors, this method always automatically closes the connection.
3007
- ---
3008
- ---@param max integer
3009
- ---@return string? data
3010
- ---@return string? error
3011
- function tcpsock:receiveany(max) end
3012
-
3013
- --- This method returns an iterator Lua function that can be called to read the data stream until it sees the specified pattern or an error occurs.
3014
- ---
3015
- --- Here is an example for using this method to read a data stream with the boundary sequence `--abcedhb`:
3016
- ---
3017
- --- ```lua
3018
- --- local reader = sock:receiveuntil("\r\n--abcedhb")
3019
- --- local data, err, partial = reader()
3020
- --- if not data then
3021
- --- ngx.say("failed to read the data stream: ", err)
3022
- --- end
3023
- --- ngx.say("read the data stream: ", data)
3024
- --- ```
3025
- ---
3026
- --- When called without any argument, the iterator function returns the received data right *before* the specified pattern string in the incoming data stream. So for the example above, if the incoming data stream is `'hello, world! -agentzh\r\n--abcedhb blah blah'`, then the string `'hello, world! -agentzh'` will be returned.
3027
- ---
3028
- --- In case of error, the iterator function will return `nil` along with a string describing the error and the partial data bytes that have been read so far.
3029
- ---
3030
- --- The iterator function can be called multiple times and can be mixed safely with other cosocket method calls or other iterator function calls.
3031
- ---
3032
- --- The iterator function behaves differently (i.e., like a real iterator) when it is called with a `size` argument. That is, it will read that `size` of data on each invocation and will return `nil` at the last invocation (either sees the boundary pattern or meets an error). For the last successful invocation of the iterator function, the `err` return value will be `nil` too. The iterator function will be reset after the last successful invocation that returns `nil` data and `nil` error. Consider the following example:
3033
- ---
3034
- --- ```lua
3035
- --- local reader = sock:receiveuntil("\r\n--abcedhb")
3036
- ---
3037
- --- while true do
3038
- --- local data, err, partial = reader(4)
3039
- --- if not data then
3040
- --- if err then
3041
- --- ngx.say("failed to read the data stream: ", err)
3042
- --- break
3043
- --- end
3044
- ---
3045
- --- ngx.say("read done")
3046
- --- break
3047
- --- end
3048
- --- ngx.say("read chunk: [", data, "]")
3049
- --- end
3050
- --- ```
3051
- ---
3052
- --- Then for the incoming data stream `'hello, world! -agentzh\r\n--abcedhb blah blah'`, we shall get the following output from the sample code above:
3053
- ---
3054
- --- read chunk: [hell]
3055
- --- read chunk: [o, w]
3056
- --- read chunk: [orld]
3057
- --- read chunk: [! -a]
3058
- --- read chunk: [gent]
3059
- --- read chunk: [zh]
3060
- --- read done
3061
- ---
3062
- --- Note that, the actual data returned *might* be a little longer than the size limit specified by the `size` argument when the boundary pattern has ambiguity for streaming parsing. Near the boundary of the data stream, the data string actually returned could also be shorter than the size limit.
3063
- ---
3064
- --- Timeout for the iterator function's reading operation is controlled by the `lua_socket_read_timeout` config directive and the `settimeout` method. And the latter takes priority. For example:
3065
- ---
3066
- --- ```lua
3067
- --- local readline = sock:receiveuntil("\r\n")
3068
- ---
3069
- --- sock:settimeout(1000) -- one second timeout
3070
- --- line, err, partial = readline()
3071
- --- if not line then
3072
- --- ngx.say("failed to read a line: ", err)
3073
- --- return
3074
- --- end
3075
- --- ngx.say("successfully read a line: ", line)
3076
- --- ```
3077
- ---
3078
- --- It is important here to call the `settimeout` method *before* calling the iterator function (note that the `receiveuntil` call is irrelevant here).
3079
- ---
3080
- --- This method also takes an optional `options` table argument to control the behavior. The following options are supported:
3081
- ---
3082
- --- * `inclusive`
3083
- ---
3084
- --- The `inclusive` takes a boolean value to control whether to include the pattern string in the returned data string. Default to `false`. For example,
3085
- ---
3086
- --- ```lua
3087
- --- local reader = tcpsock:receiveuntil("_END_", { inclusive = true })
3088
- --- local data = reader()
3089
- --- ngx.say(data)
3090
- --- ```
3091
- ---
3092
- --- Then for the input data stream `"hello world _END_ blah blah blah"`, then the example above will output `hello world _END_`, including the pattern string `_END_` itself.
3093
- ---
3094
- --- This method does not automatically closes the current connection when the read timeout error happens. For other connection errors, this method always automatically closes the connection.
3095
- ---
3096
- ---@alias ngx.socket.tcpsock.iterator fun(size:number|nil):string,string,any
3097
- ---
3098
- ---@overload fun(self:tcpsock, size:number, options:table):ngx.socket.tcpsock.iterator
3099
- ---
3100
- ---@param pattern string
3101
- ---@param options? table
3102
- ---@return ngx.socket.tcpsock.iterator
3103
- function tcpsock:receiveuntil(pattern, options) end
3104
-
3105
- --- Closes the current TCP or stream unix domain socket. It returns the `1` in case of success and returns `nil` with a string describing the error otherwise.
3106
- ---
3107
- --- Note that there is no need to call this method on socket objects that have invoked the `setkeepalive` method because the socket object is already closed (and the current connection is saved into the built-in connection pool).
3108
- ---
3109
- --- Socket objects that have not invoked this method (and associated connections) will be closed when the socket object is released by the Lua GC (Garbage Collector) or the current client HTTP request finishes processing.
3110
- ---
3111
- ---@return boolean ok
3112
- ---@return string? error
3113
- function tcpsock:close() end
3114
-
3115
- --- Set the timeout value in milliseconds for subsequent socket operations (`connect`, `receive`, and iterators returned from `receiveuntil`).
3116
- ---
3117
- --- Settings done by this method take priority over those specified via config directives (i.e. `lua_socket_connect_timeout`, `lua_socket_send_timeout`, and `lua_socket_read_timeout`).
3118
- ---
3119
- --- Note that this method does *not* affect the `lua_socket_keepalive_timeout` setting; the `timeout` argument to the `setkeepalive` method should be used for this purpose instead.
3120
- ---
3121
- ---@param time number
3122
- function tcpsock:settimeout(time) end
3123
-
3124
- --- Respectively sets the connect, send, and read timeout thresholds (in milliseconds) for subsequent socket
3125
- --- operations (`connect`, `send`, `receive`, and iterators returned from `receiveuntil`).
3126
- ---
3127
- --- Settings done by this method take priority over those specified via config directives (i.e. `lua_socket_connect_timeout`, `lua_socket_send_timeout`, and `lua_socket_read_timeout`).
3128
- ---
3129
- --- It is recommended to use `settimeouts` instead of `settimeout`.
3130
- ---
3131
- --- Note that this method does *not* affect the `lua_socket_keepalive_timeout` setting; the `timeout` argument to the `setkeepalive` method should be used for this purpose instead.
3132
- ---
3133
- ---@param connect_timeout number|nil
3134
- ---@param send_timeout number|nil
3135
- ---@param read_timeout number|nil
3136
- function tcpsock:settimeouts(connect_timeout, send_timeout, read_timeout) end
3137
-
3138
- --- This function is added for `LuaSocket` API compatibility and does nothing for now.
3139
- ---
3140
- --- In case of success, it returns `true`. Otherwise, it returns nil and a string describing the error.
3141
- ---
3142
- --- The `option` is a string with the option name, and the value depends on the option being set:
3143
- ---
3144
- --- * `keepalive`
3145
- ---
3146
- --- Setting this option to true enables sending of keep-alive messages on
3147
- --- connection-oriented sockets. Make sure the `connect` function
3148
- --- had been called before, for example,
3149
- ---
3150
- --- ```lua
3151
- --- local ok, err = tcpsock:setoption("keepalive", true)
3152
- --- if not ok then
3153
- --- ngx.say("setoption keepalive failed: ", err)
3154
- --- end
3155
- --- ```
3156
- --- * `reuseaddr`
3157
- ---
3158
- --- Enabling this option indicates that the rules used in validating addresses
3159
- --- supplied in a call to bind should allow reuse of local addresses. Make sure
3160
- --- the `connect` function had been called before, for example,
3161
- ---
3162
- --- ```lua
3163
- --- local ok, err = tcpsock:setoption("reuseaddr", 0)
3164
- --- if not ok then
3165
- --- ngx.say("setoption reuseaddr failed: ", err)
3166
- --- end
3167
- --- ```
3168
- --- * `tcp-nodelay`
3169
- ---
3170
- --- Setting this option to true disables the Nagle's algorithm for the connection.
3171
- --- Make sure the `connect` function had been called before, for example,
3172
- ---
3173
- --- ```lua
3174
- --- local ok, err = tcpsock:setoption("tcp-nodelay", true)
3175
- --- if not ok then
3176
- --- ngx.say("setoption tcp-nodelay failed: ", err)
3177
- --- end
3178
- --- ```
3179
- --- * `sndbuf`
3180
- ---
3181
- --- Sets the maximum socket send buffer in bytes. The kernel doubles this value
3182
- --- (to allow space for bookkeeping overhead) when it is set using setsockopt().
3183
- --- Make sure the `connect` function had been called before, for example,
3184
- ---
3185
- --- ```lua
3186
- --- local ok, err = tcpsock:setoption("sndbuf", 1024 * 10)
3187
- --- if not ok then
3188
- --- ngx.say("setoption sndbuf failed: ", err)
3189
- --- end
3190
- --- ```
3191
- --- * `rcvbuf`
3192
- ---
3193
- --- Sets the maximum socket receive buffer in bytes. The kernel doubles this value
3194
- --- (to allow space for bookkeeping overhead) when it is set using setsockopt. Make
3195
- --- sure the `connect` function had been called before, for example,
3196
- ---
3197
- --- ```lua
3198
- --- local ok, err = tcpsock:setoption("rcvbuf", 1024 * 10)
3199
- --- if not ok then
3200
- --- ngx.say("setoption rcvbuf failed: ", err)
3201
- --- end
3202
- --- ```
3203
- ---
3204
- --- NOTE: Once the option is set, it will become effective until the connection is closed. If you know the connection is from the connection pool and all the in-pool connections already have called the setoption() method with the desired socket option state, then you can just skip calling setoption() again to avoid the overhead of repeated calls, for example,
3205
- ---
3206
- --- ```lua
3207
- --- local count, err = tcpsock:getreusedtimes()
3208
- --- if not count then
3209
- --- ngx.say("getreusedtimes failed: ", err)
3210
- --- return
3211
- --- end
3212
- ---
3213
- --- if count == 0 then
3214
- --- local ok, err = tcpsock:setoption("rcvbuf", 1024 * 10)
3215
- --- if not ok then
3216
- --- ngx.say("setoption rcvbuf failed: ", err)
3217
- --- return
3218
- --- end
3219
- --- end
3220
- --- ```
3221
- ---
3222
- ---@param option tcpsock.setoption.option
3223
- ---@param value number|boolean
3224
- ---@return boolean ok
3225
- ---@return string? error
3226
- function tcpsock:setoption(option, value) end
3227
-
3228
- ---@alias tcpsock.setoption.option
3229
- ---| '"keepalive"' # enable or disable keepalive
3230
- ---| '"reuseaddr"' # reuse addr options
3231
- ---| '"tcp-nodelay"' # disables the Nagle's algorithm for the connection.
3232
- ---| '"sndbuf"' # max send buffer size (in bytes)
3233
- ---| '"rcvbuf"' # max receive bufer size (in bytes)
3234
-
3235
- --- Puts the current socket's connection immediately into the cosocket built-in connection pool and keep it alive until other `connect` method calls request it or the associated maximal idle timeout is expired.
3236
- ---
3237
- --- The first optional argument, `timeout`, can be used to specify the maximal idle timeout (in milliseconds) for the current connection. If omitted, the default setting in the `lua_socket_keepalive_timeout` config directive will be used. If the `0` value is given, then the timeout interval is unlimited.
3238
- ---
3239
- --- The second optional argument `size` is considered deprecated since the `v0.10.14` release of this module, in favor of the `pool_size` option of the `connect` method.
3240
- --- Since the `v0.10.14` release, this option will only take effect if the call to `connect` did not already create a connection pool.
3241
- --- When this option takes effect (no connection pool was previously created by `connect`), it will specify the size of the connection pool, and create it.
3242
- --- If omitted (and no pool was previously created), the default size is the value of the `lua_socket_pool_size` directive.
3243
- --- The connection pool holds up to `size` alive connections ready to be reused by subsequent calls to `connect`, but note that there is no upper limit to the total number of opened connections outside of the pool.
3244
- --- When the connection pool would exceed its size limit, the least recently used (kept-alive) connection already in the pool will be closed to make room for the current connection.
3245
- --- Note that the cosocket connection pool is per NGINX worker process rather than per NGINX server instance, so the size limit specified here also applies to every single NGINX worker process. Also note that the size of the connection pool cannot be changed once it has been created.
3246
- --- If you need to restrict the total number of opened connections, specify both the `pool_size` and `backlog` option in the call to `connect`.
3247
- ---
3248
- --- In case of success, this method returns `1`; otherwise, it returns `nil` and a string describing the error.
3249
- ---
3250
- --- When the system receive buffer for the current connection has unread data, then this method will return the "connection in dubious state" error message (as the second return value) because the previous session has unread data left behind for the next session and the connection is not safe to be reused.
3251
- ---
3252
- --- This method also makes the current cosocket object enter the "closed" state, so there is no need to manually call the `close` method on it afterwards.
3253
- ---
3254
- ---@param timeout? number
3255
- ---@param size? number
3256
- ---@return boolean ok
3257
- ---@return string? error
3258
- function tcpsock:setkeepalive(timeout, size) end
3259
-
3260
- --- This method returns the (successfully) reused times for the current connection. In case of error, it returns `nil` and a string describing the error.
3261
- ---
3262
- --- If the current connection does not come from the built-in connection pool, then this method always returns `0`, that is, the connection has never been reused (yet). If the connection comes from the connection pool, then the return value is always non-zero. So this method can also be used to determine if the current connection comes from the pool.
3263
- ---
3264
- ---@return number? count
3265
- ---@return string? error
3266
- function tcpsock:getreusedtimes() end
3267
-
3268
- --- This function is a shortcut for combining `ngx.socket.tcp()` and the `connect()` method call in a single operation. It is actually implemented like this:
3269
- ---
3270
- --- ```lua
3271
- --- local sock = ngx.socket.tcp()
3272
- --- local ok, err = sock:connect(...)
3273
- --- if not ok then
3274
- --- return nil, err
3275
- --- end
3276
- --- return sock
3277
- --- ```
3278
- ---
3279
- --- There is no way to use the `settimeout` method to specify connecting timeout for this method and the `lua_socket_connect_timeout` directive must be set at configure time instead.
3280
- ---
3281
- ---@param host string
3282
- ---@param port? number
3283
- ---@return tcpsock? socket
3284
- ---@return string? error
3285
- function ngx.socket.connect(host, port) end
3286
-
3287
- --- Creates and returns a UDP or datagram-oriented unix domain socket object (also known as one type of the "cosocket" objects). The following methods are supported on this object:
3288
- ---
3289
- --- * `setpeername`
3290
- --- * `send`
3291
- --- * `receive`
3292
- --- * `close`
3293
- --- * `settimeout`
3294
- ---
3295
- --- It is intended to be compatible with the UDP API of the `LuaSocket` library but is 100% nonblocking out of the box.
3296
- ---
3297
- ---@return udpsock
3298
- function ngx.socket.udp() end
3299
-
3300
- --- Just an alias to `ngx.socket.tcp`. If the stream-typed cosocket may also connect to a unix domain
3301
- --- socket, then this API name is preferred.
3302
- ---
3303
- function ngx.socket.stream() end
3304
-
3305
- --- When this is used in the context of the `set_by_lua*` directives, this table is read-only and holds the input arguments to the config directives:
3306
- ---
3307
- --- ```lua
3308
- --- value = ngx.arg[n]
3309
- --- ```
3310
- ---
3311
- --- Here is an example
3312
- ---
3313
- --- ```nginx
3314
- --- location /foo {
3315
- --- set $a 32;
3316
- --- set $b 56;
3317
- ---
3318
- --- set_by_lua $sum
3319
- --- 'return tonumber(ngx.arg[1]) + tonumber(ngx.arg[2])'
3320
- --- $a $b;
3321
- ---
3322
- --- echo $sum;
3323
- --- }
3324
- --- ```
3325
- ---
3326
- --- that writes out `88`, the sum of `32` and `56`.
3327
- ---
3328
- --- When this table is used in the context of `body_filter_by_lua*`, the first element holds the input data chunk to the output filter code and the second element holds the boolean flag for the "eof" flag indicating the end of the whole output data stream.
3329
- ---
3330
- --- The data chunk and "eof" flag passed to the downstream NGINX output filters can also be overridden by assigning values directly to the corresponding table elements. When setting `nil` or an empty Lua string value to `ngx.arg[1]`, no data chunk will be passed to the downstream NGINX output filters at all.
3331
- ngx.arg = {}
3332
-
3333
- ---@alias ngx.phase.name
3334
- ---| '"init"'
3335
- ---| '"init_worker"'
3336
- ---| '"ssl_cert"'
3337
- ---| '"ssl_session_fetch"'
3338
- ---| '"ssl_session_store"'
3339
- ---| '"set"'
3340
- ---| '"rewrite"'
3341
- ---| '"balancer"'
3342
- ---| '"access"'
3343
- ---| '"content"'
3344
- ---| '"header_filter"'
3345
- ---| '"body_filter"'
3346
- ---| '"log"'
3347
- ---| '"timer"'
3348
-
3349
- --- Retrieves the current running phase name.
3350
- ---
3351
- ---@return ngx.phase.name
3352
- function ngx.get_phase() end
3353
-
3354
- --- When `status >= 200` (i.e., `ngx.HTTP_OK` and above), it will interrupt the execution of the current request and return status code to NGINX.
3355
- ---
3356
- --- When `status == 0` (i.e., `ngx.OK`), it will only quit the current phase handler (or the content handler if the `content_by_lua*` directive is used) and continue to run later phases (if any) for the current request.
3357
- ---
3358
- --- The `status` argument can be `ngx.OK`, `ngx.ERROR`, `ngx.HTTP_NOT_FOUND`,
3359
- --- `ngx.HTTP_MOVED_TEMPORARILY`, or other `ngx.HTTP_*` status constants.
3360
- ---
3361
- --- To return an error page with custom contents, use code snippets like this:
3362
- ---
3363
- --- ```lua
3364
- --- ngx.status = ngx.HTTP_GONE
3365
- --- ngx.say("This is our own content")
3366
- --- -- to cause quit the whole request rather than the current phase handler
3367
- --- ngx.exit(ngx.HTTP_OK)
3368
- --- ```
3369
- ---
3370
- --- The effect in action:
3371
- ---
3372
- --- ```bash
3373
- --- $ curl -i http://localhost/test
3374
- --- HTTP/1.1 410 Gone
3375
- --- Server: nginx/1.0.6
3376
- --- Date: Thu, 15 Sep 2011 00:51:48 GMT
3377
- --- Content-Type: text/plain
3378
- --- Transfer-Encoding: chunked
3379
- --- Connection: keep-alive
3380
- ---
3381
- --- This is our own content
3382
- --- ```
3383
- ---
3384
- --- Number literals can be used directly as the argument, for instance,
3385
- ---
3386
- --- ```lua
3387
- --- ngx.exit(501)
3388
- --- ```
3389
- ---
3390
- --- Note that while this method accepts all `ngx.HTTP_*` status constants as input, it only accepts `ngx.OK` and `ngx.ERROR` of the `core constants`.
3391
- ---
3392
- --- Also note that this method call terminates the processing of the current request and that it is recommended that a coding style that combines this method call with the `return` statement, i.e., `return ngx.exit(...)` be used to reinforce the fact that the request processing is being terminated.
3393
- ---
3394
- --- When being used in the contexts of `header_filter_by_lua*`, `balancer_by_lua*`, and
3395
- --- `ssl_session_store_by_lua*`, `ngx.exit()` is
3396
- --- an asynchronous operation and will return immediately. This behavior may change in future and it is recommended that users always use `return` in combination as suggested above.
3397
- ---
3398
- ---@param status ngx.OK|ngx.ERROR|ngx.http.status_code
3399
- function ngx.exit(status) end
3400
-
3401
- --- Issue an `HTTP 301` or `302` redirection to `uri`.
3402
- ---
3403
- --- Notice: the `uri` should not contains `\r` or `\n`, otherwise, the characters after `\r` or `\n` will be truncated, including the `\r` or `\n` bytes themself.
3404
- ---
3405
- --- The `uri` argument will be truncated if it contains the
3406
- --- `\r` or `\n` characters. The truncated value will contain
3407
- --- all characters up to (and excluding) the first occurrence of `\r` or
3408
- --- `\n`.
3409
- ---
3410
- --- The optional `status` parameter specifies the HTTP status code to be used. The following status codes are supported right now:
3411
- ---
3412
- --- * `301`
3413
- --- * `302` (default)
3414
- --- * `303`
3415
- --- * `307`
3416
- --- * `308`
3417
- ---
3418
- --- It is `302` (`ngx.HTTP_MOVED_TEMPORARILY`) by default.
3419
- ---
3420
- --- Here is an example assuming the current server name is `localhost` and that it is listening on port 1984:
3421
- ---
3422
- --- ```lua
3423
- --- return ngx.redirect("/foo")
3424
- --- ```
3425
- ---
3426
- --- which is equivalent to
3427
- ---
3428
- --- ```lua
3429
- --- return ngx.redirect("/foo", ngx.HTTP_MOVED_TEMPORARILY)
3430
- --- ```
3431
- ---
3432
- --- Redirecting arbitrary external URLs is also supported, for example:
3433
- ---
3434
- --- ```lua
3435
- --- return ngx.redirect("http://www.google.com")
3436
- --- ```
3437
- ---
3438
- --- We can also use the numerical code directly as the second `status` argument:
3439
- ---
3440
- --- ```lua
3441
- --- return ngx.redirect("/foo", 301)
3442
- --- ```
3443
- ---
3444
- --- This method is similar to the `rewrite` directive with the `redirect` modifier in the standard
3445
- --- `ngx_http_rewrite_module`, for example, this `nginx.conf` snippet
3446
- ---
3447
- --- ```nginx
3448
- --- rewrite ^ /foo? redirect; # nginx config
3449
- --- ```
3450
- ---
3451
- --- is equivalent to the following Lua code
3452
- ---
3453
- --- ```lua
3454
- --- return ngx.redirect('/foo'); -- Lua code
3455
- --- ```
3456
- ---
3457
- --- while
3458
- ---
3459
- --- ```nginx
3460
- --- rewrite ^ /foo? permanent; # nginx config
3461
- --- ```
3462
- ---
3463
- --- is equivalent to
3464
- ---
3465
- --- ```lua
3466
- --- return ngx.redirect('/foo', ngx.HTTP_MOVED_PERMANENTLY) -- Lua code
3467
- --- ```
3468
- ---
3469
- --- URI arguments can be specified as well, for example:
3470
- ---
3471
- --- ```lua
3472
- --- return ngx.redirect('/foo?a=3&b=4')
3473
- --- ```
3474
- ---
3475
- --- Note that this method call terminates the processing of the current request and that it *must* be called before `ngx.send_headers` or explicit response body
3476
- --- outputs by either `ngx.print` or `ngx.say`.
3477
- ---
3478
- --- It is recommended that a coding style that combines this method call with the `return` statement, i.e., `return ngx.redirect(...)` be adopted when this method call is used in contexts other than `header_filter_by_lua*` to reinforce the fact that the request processing is being terminated.
3479
- ---
3480
- ---@param uri string
3481
- ---@param status? 301|302|303|307|308
3482
- function ngx.redirect(uri, status) end
3483
-
3484
- --- Registers a user Lua function as the callback which gets called automatically when the client closes the (downstream) connection prematurely.
3485
- ---
3486
- --- Returns `1` if the callback is registered successfully or returns `nil` and a string describing the error otherwise.
3487
- ---
3488
- --- All the NGINX APIs for lua can be used in the callback function because the function is run in a special "light thread", just as those "light threads" created by `ngx.thread.spawn`.
3489
- ---
3490
- --- The callback function can decide what to do with the client abortion event all by itself. For example, it can simply ignore the event by doing nothing and the current Lua request handler will continue executing without interruptions. And the callback function can also decide to terminate everything by calling `ngx.exit`, for example,
3491
- ---
3492
- --- ```lua
3493
- --- local function my_cleanup()
3494
- --- -- custom cleanup work goes here, like cancelling a pending DB transaction
3495
- ---
3496
- --- -- now abort all the "light threads" running in the current request handler
3497
- --- ngx.exit(499)
3498
- --- end
3499
- ---
3500
- --- local ok, err = ngx.on_abort(my_cleanup)
3501
- --- if not ok then
3502
- --- ngx.log(ngx.ERR, "failed to register the on_abort callback: ", err)
3503
- --- ngx.exit(500)
3504
- --- end
3505
- --- ```
3506
- ---
3507
- --- When `lua_check_client_abort` is set to `off` (which is the default), then this function call will always return the error message "lua_check_client_abort is off".
3508
- ---
3509
- --- According to the current implementation, this function can only be called once in a single request handler; subsequent calls will return the error message "duplicate call".
3510
- ---
3511
- ---@param callback fun()
3512
- ---@return boolean ok
3513
- ---@return string|'"lua_check_client_abort is off"'|'"duplicate call"' error
3514
- function ngx.on_abort(callback) end
3515
-
3516
- --- Does an internal redirect to `uri` with `args` and is similar to the `echo_exec` directive of the `echo-nginx-module`.
3517
- ---
3518
- --- ```lua
3519
- --- ngx.exec('/some-location');
3520
- --- ngx.exec('/some-location', 'a=3&b=5&c=6');
3521
- --- ngx.exec('/some-location?a=3&b=5', 'c=6');
3522
- --- ```
3523
- ---
3524
- --- The optional second `args` can be used to specify extra URI query arguments, for example:
3525
- ---
3526
- --- ```lua
3527
- --- ngx.exec("/foo", "a=3&b=hello%20world")
3528
- --- ```
3529
- ---
3530
- --- Alternatively, a Lua table can be passed for the `args` argument for ngx_lua to carry out URI escaping and string concatenation.
3531
- ---
3532
- --- ```lua
3533
- --- ngx.exec("/foo", { a = 3, b = "hello world" })
3534
- --- ```
3535
- ---
3536
- --- The result is exactly the same as the previous example.
3537
- ---
3538
- --- The format for the Lua table passed as the `args` argument is identical to the format used in the `ngx.encode_args` method.
3539
- ---
3540
- --- Named locations are also supported but the second `args` argument will be ignored if present and the querystring for the new target is inherited from the referring location (if any).
3541
- ---
3542
- --- `GET /foo/file.php?a=hello` will return "hello" and not "goodbye" in the example below
3543
- ---
3544
- --- ```nginx
3545
- --- location /foo {
3546
- --- content_by_lua_block {
3547
- --- ngx.exec("@bar", "a=goodbye");
3548
- --- }
3549
- --- }
3550
- ---
3551
- --- location @bar {
3552
- --- content_by_lua_block {
3553
- --- local args = ngx.req.get_uri_args()
3554
- --- for key, val in pairs(args) do
3555
- --- if key == "a" then
3556
- --- ngx.say(val)
3557
- --- end
3558
- --- end
3559
- --- }
3560
- --- }
3561
- --- ```
3562
- ---
3563
- --- Note that the `ngx.exec` method is different from `ngx.redirect` in that
3564
- --- it is purely an internal redirect and that no new external HTTP traffic is involved.
3565
- ---
3566
- --- Also note that this method call terminates the processing of the current request and that it *must* be called before `ngx.send_headers` or explicit response body
3567
- --- outputs by either `ngx.print` or `ngx.say`.
3568
- ---
3569
- --- It is recommended that a coding style that combines this method call with the `return` statement, i.e., `return ngx.exec(...)` be adopted when this method call is used in contexts other than `header_filter_by_lua*` to reinforce the fact that the request processing is being terminated.
3570
- ---
3571
- ---@param uri string
3572
- ---@param args? string|table<string,any>
3573
- function ngx.exec(uri, args) end
3574
-
3575
- ngx.location = {}
3576
-
3577
- ---@class ngx.location.capture.response : table
3578
- ---@field status integer # response status code
3579
- ---@field header table<string, string|string[]> # response headers
3580
- ---@field body string # response body
3581
- ---@field truncated boolean # truth-y if the response body is truncated. You always need to check the `res.truncated` boolean flag to see if `res.body` contains truncated data. The data truncation here can only be caused by those unrecoverable errors in your subrequests like the cases that the remote end aborts the connection prematurely in the middle of the response body data stream or a read timeout happens when your subrequest is receiving the response body data from the remote.
3582
-
3583
- --- An optional option table can be fed as the second argument, which supports the options:
3584
- ---
3585
- ---@class ngx.location.capture.options
3586
- ---
3587
- ---@field method ngx.http.method # the subrequest's request method, which only accepts constants like `ngx.HTTP_POST`.
3588
- ---
3589
- ---@field body string # the subrequest's request body (string value only).
3590
- ---
3591
- ---@field args string|table # the subrequest's URI query arguments (both string value and Lua tables are accepted)
3592
- ---@field ctx table # a Lua table to be the `ngx.ctx` table for the subrequest. It can be the current request's `ngx.ctx` table, which effectively makes the parent and its subrequest to share exactly the same context table.
3593
- ---
3594
- ---@field vars table # a Lua table which holds the values to set the specified NGINX variables in the subrequest as this option's value.
3595
- ---
3596
- ---@field copy_all_vars boolean # whether to copy over all the NGINX variable values of the current request to the subrequest in question. modifications of the NGINX variables in the subrequest will not affect the current (parent) request.
3597
- ---
3598
- ---@field share_all_vars boolean # whether to share all the NGINX variables of the subrequest with the current (parent) request. modifications of the NGINX variables in the subrequest will affect the current (parent) request. Enabling this option may lead to hard-to-debug issues due to bad side-effects and is considered bad and harmful. Only enable this option when you completely know what you are doing.
3599
- ---
3600
- ---@field always_forward_body boolean # when set to true, the current (parent) request's request body will always be forwarded to the subrequest being created if the `body` option is not specified. The request body read by either `ngx.req.read_body()` or `lua_need_request_body on` will be directly forwarded to the subrequest without copying the whole request body data when creating the subrequest (no matter the request body data is buffered in memory buffers or temporary files). By default, this option is `false` and when the `body` option is not specified, the request body of the current (parent) request is only forwarded when the subrequest takes the `PUT` or `POST` request method.
3601
-
3602
- ---@alias ngx.location.capture.uri string
3603
-
3604
- ---@class ngx.location.capture.arg : table
3605
- ---@field [1] ngx.location.capture.uri request uri
3606
- ---@field [2] ngx.location.capture.options? request options
3607
-
3608
- --- Issues a synchronous but still non-blocking *NGINX Subrequest* using `uri`.
3609
- ---
3610
- --- NGINX's subrequests provide a powerful way to make non-blocking internal requests to other locations configured with disk file directory or *any* other NGINX C modules like `ngx_proxy`, `ngx_fastcgi`, `ngx_memc`,
3611
- --- `ngx_postgres`, `ngx_drizzle`, and even ngx_lua itself and etc etc etc.
3612
- ---
3613
- --- Also note that subrequests just mimic the HTTP interface but there is *no* extra HTTP/TCP traffic *nor* IPC involved. Everything works internally, efficiently, on the C level.
3614
- ---
3615
- --- Subrequests are completely different from HTTP 301/302 redirection (via `ngx.redirect`) and internal redirection (via `ngx.exec`).
3616
- ---
3617
- --- You should always read the request body (by either calling `ngx.req.read_body` or configuring `lua_need_request_body` on) before initiating a subrequest.
3618
- ---
3619
- --- This API function (as well as `ngx.location.capture_multi`) always buffers the whole response body of the subrequest in memory. Thus, you should use `cosockets`
3620
- --- and streaming processing instead if you have to handle large subrequest responses.
3621
- ---
3622
- --- Here is a basic example:
3623
- ---
3624
- --- ```lua
3625
- --- res = ngx.location.capture(uri)
3626
- --- ```
3627
- ---
3628
- --- Returns a Lua table with 4 slots: `res.status`, `res.header`, `res.body`, and `res.truncated`.
3629
- ---
3630
- --- URI query strings can be concatenated to URI itself, for instance,
3631
- ---
3632
- --- ```lua
3633
- --- res = ngx.location.capture('/foo/bar?a=3&b=4')
3634
- --- ```
3635
- ---
3636
- --- Named locations like `@foo` are not allowed due to a limitation in
3637
- --- the NGINX core. Use normal locations combined with the `internal` directive to
3638
- --- prepare internal-only locations.
3639
- ---
3640
- --- An optional option table can be fed as the second argument.
3641
- ---
3642
- --- Issuing a POST subrequest, for example, can be done as follows
3643
- ---
3644
- --- ```lua
3645
- --- res = ngx.location.capture(
3646
- --- '/foo/bar',
3647
- --- { method = ngx.HTTP_POST, body = 'hello, world' }
3648
- --- )
3649
- --- ```
3650
- ---
3651
- --- See HTTP method constants methods other than POST.
3652
- --- The `method` option is `ngx.HTTP_GET` by default.
3653
- ---
3654
- --- The `args` option can specify extra URI arguments, for instance,
3655
- ---
3656
- --- ```lua
3657
- --- ngx.location.capture('/foo?a=1',
3658
- --- { args = { b = 3, c = ':' } }
3659
- --- )
3660
- --- ```
3661
- ---
3662
- --- is equivalent to
3663
- ---
3664
- --- ```lua
3665
- --- ngx.location.capture('/foo?a=1&b=3&c=%3a')
3666
- --- ```
3667
- ---
3668
- --- that is, this method will escape argument keys and values according to URI rules and
3669
- --- concatenate them together into a complete query string. The format for the Lua table passed as the `args` argument is identical to the format used in the `ngx.encode_args` method.
3670
- ---
3671
- --- The `args` option can also take plain query strings:
3672
- ---
3673
- --- ```lua
3674
- --- ngx.location.capture('/foo?a=1',
3675
- --- { args = 'b=3&c=%3a' }
3676
- --- )
3677
- --- ```
3678
- ---
3679
- --- This is functionally identical to the previous examples.
3680
- ---
3681
- --- The `share_all_vars` option controls whether to share NGINX variables among the current request and its subrequests.
3682
- --- If this option is set to `true`, then the current request and associated subrequests will share the same NGINX variable scope. Hence, changes to NGINX variables made by a subrequest will affect the current request.
3683
- ---
3684
- --- Care should be taken in using this option as variable scope sharing can have unexpected side effects. The `args`, `vars`, or `copy_all_vars` options are generally preferable instead.
3685
- ---
3686
- --- This option is set to `false` by default
3687
- ---
3688
- --- ```nginx
3689
- --- location /other {
3690
- --- set $dog "$dog world";
3691
- --- echo "$uri dog: $dog";
3692
- --- }
3693
- ---
3694
- --- location /lua {
3695
- --- set $dog 'hello';
3696
- --- content_by_lua_block {
3697
- --- res = ngx.location.capture("/other",
3698
- --- { share_all_vars = true });
3699
- ---
3700
- --- ngx.print(res.body)
3701
- --- ngx.say(ngx.var.uri, ": ", ngx.var.dog)
3702
- --- }
3703
- --- }
3704
- --- ```
3705
- ---
3706
- --- Accessing location `/lua` gives
3707
- ---
3708
- --- /other dog: hello world
3709
- --- /lua: hello world
3710
- ---
3711
- --- The `copy_all_vars` option provides a copy of the parent request's NGINX variables to subrequests when such subrequests are issued. Changes made to these variables by such subrequests will not affect the parent request or any other subrequests sharing the parent request's variables.
3712
- ---
3713
- --- ```nginx
3714
- --- location /other {
3715
- --- set $dog "$dog world";
3716
- --- echo "$uri dog: $dog";
3717
- --- }
3718
- ---
3719
- --- location /lua {
3720
- --- set $dog 'hello';
3721
- --- content_by_lua_block {
3722
- --- res = ngx.location.capture("/other",
3723
- --- { copy_all_vars = true });
3724
- ---
3725
- --- ngx.print(res.body)
3726
- --- ngx.say(ngx.var.uri, ": ", ngx.var.dog)
3727
- --- }
3728
- --- }
3729
- --- ```
3730
- ---
3731
- --- Request `GET /lua` will give the output
3732
- ---
3733
- --- /other dog: hello world
3734
- --- /lua: hello
3735
- ---
3736
- --- Note that if both `share_all_vars` and `copy_all_vars` are set to true, then `share_all_vars` takes precedence.
3737
- ---
3738
- --- In addition to the two settings above, it is possible to specify
3739
- --- values for variables in the subrequest using the `vars` option. These
3740
- --- variables are set after the sharing or copying of variables has been
3741
- --- evaluated, and provides a more efficient method of passing specific
3742
- --- values to a subrequest over encoding them as URL arguments and
3743
- --- unescaping them in the NGINX config file.
3744
- ---
3745
- --- ```nginx
3746
- --- location /other {
3747
- --- content_by_lua_block {
3748
- --- ngx.say("dog = ", ngx.var.dog)
3749
- --- ngx.say("cat = ", ngx.var.cat)
3750
- --- }
3751
- --- }
3752
- ---
3753
- --- location /lua {
3754
- --- set $dog '';
3755
- --- set $cat '';
3756
- --- content_by_lua_block {
3757
- --- res = ngx.location.capture("/other",
3758
- --- { vars = { dog = "hello", cat = 32 }});
3759
- ---
3760
- --- ngx.print(res.body)
3761
- --- }
3762
- --- }
3763
- --- ```
3764
- ---
3765
- --- Accessing `/lua` will yield the output
3766
- ---
3767
- --- dog = hello
3768
- --- cat = 32
3769
- ---
3770
- --- The `ctx` option can be used to specify a custom Lua table to serve as the `ngx.ctx` table for the subrequest.
3771
- ---
3772
- --- ```nginx
3773
- --- location /sub {
3774
- --- content_by_lua_block {
3775
- --- ngx.ctx.foo = "bar";
3776
- --- }
3777
- --- }
3778
- --- location /lua {
3779
- --- content_by_lua_block {
3780
- --- local ctx = {}
3781
- --- res = ngx.location.capture("/sub", { ctx = ctx })
3782
- ---
3783
- --- ngx.say(ctx.foo);
3784
- --- ngx.say(ngx.ctx.foo);
3785
- --- }
3786
- --- }
3787
- --- ```
3788
- ---
3789
- --- Then request `GET /lua` gives
3790
- ---
3791
- --- bar
3792
- --- nil
3793
- ---
3794
- --- It is also possible to use this `ctx` option to share the same `ngx.ctx` table between the current (parent) request and the subrequest:
3795
- ---
3796
- --- ```nginx
3797
- --- location /sub {
3798
- --- content_by_lua_block {
3799
- --- ngx.ctx.foo = "bar";
3800
- --- }
3801
- --- }
3802
- --- location /lua {
3803
- --- content_by_lua_block {
3804
- --- res = ngx.location.capture("/sub", { ctx = ngx.ctx })
3805
- --- ngx.say(ngx.ctx.foo);
3806
- --- }
3807
- --- }
3808
- --- ```
3809
- ---
3810
- --- Request `GET /lua` yields the output
3811
- ---
3812
- --- bar
3813
- ---
3814
- --- Note that subrequests issued by `ngx.location.capture` inherit all the
3815
- --- request headers of the current request by default and that this may have unexpected side effects on the
3816
- --- subrequest responses. For example, when using the standard `ngx_proxy` module to serve
3817
- --- subrequests, an "Accept-Encoding: gzip" header in the main request may result
3818
- --- in gzipped responses that cannot be handled properly in Lua code. Original request headers should be ignored by setting
3819
- --- `proxy_pass_request_headers` to `off` in subrequest locations.
3820
- ---
3821
- --- When the `body` option is not specified and the `always_forward_body` option is false (the default value), the `POST` and `PUT` subrequests will inherit the request bodies of the parent request (if any).
3822
- ---
3823
- --- There is a hard-coded upper limit on the number of concurrent subrequests possible for every main request. In older versions of NGINX, the limit was `50` concurrent subrequests and in more recent versions, NGINX `1.1.x` onwards, this was increased to `200` concurrent subrequests. When this limit is exceeded, the following error message is added to the `error.log` file:
3824
- ---
3825
- --- [error] 13983#0: *1 subrequests cycle while processing "/uri"
3826
- ---
3827
- --- The limit can be manually modified if required by editing the definition of the `NGX_HTTP_MAX_SUBREQUESTS` macro in the `nginx/src/http/ngx_http_request.h` file in the NGINX source tree.
3828
- ---
3829
- --- Please also refer to restrictions on capturing locations configured by subrequest directives of other modules.
3830
- ---
3831
- ---@param uri ngx.location.capture.uri
3832
- ---@param options? ngx.location.capture.options
3833
- ---@return ngx.location.capture.response
3834
- function ngx.location.capture(uri, options) end
3835
-
3836
- --- Just like `ngx.location.capture`, but supports multiple subrequests running in parallel.
3837
- ---
3838
- --- This function issues several parallel subrequests specified by the input table and returns their results in the same order. For example,
3839
- ---
3840
- --- ```lua
3841
- --- local res1, res2, res3 = ngx.location.capture_multi{
3842
- --- { "/foo", { args = "a=3&b=4" } },
3843
- --- { "/bar" },
3844
- --- { "/baz", { method = ngx.HTTP_POST, body = "hello" } },
3845
- --- }
3846
- ---
3847
- --- if res1.status == ngx.HTTP_OK then
3848
- --- ...
3849
- --- end
3850
- ---
3851
- --- if res2.body == "BLAH" then
3852
- --- ...
3853
- --- end
3854
- --- ```
3855
- ---
3856
- --- This function will not return until all the subrequests terminate.
3857
- --- The total latency is the longest latency of the individual subrequests rather than the sum.
3858
- ---
3859
- --- Lua tables can be used for both requests and responses when the number of subrequests to be issued is not known in advance:
3860
- ---
3861
- --- ```lua
3862
- --- -- construct the requests table
3863
- --- local reqs = {}
3864
- --- table.insert(reqs, { "/mysql" })
3865
- --- table.insert(reqs, { "/postgres" })
3866
- --- table.insert(reqs, { "/redis" })
3867
- --- table.insert(reqs, { "/memcached" })
3868
- ---
3869
- --- -- issue all the requests at once and wait until they all return
3870
- --- local resps = { ngx.location.capture_multi(reqs) }
3871
- ---
3872
- --- -- loop over the responses table
3873
- --- for i, resp in ipairs(resps) do
3874
- --- -- process the response table "resp"
3875
- --- end
3876
- --- ```
3877
- ---
3878
- --- The `ngx.location.capture` function is just a special form
3879
- --- of this function. Logically speaking, the `ngx.location.capture` can be implemented like this
3880
- ---
3881
- --- ```lua
3882
- --- ngx.location.capture = function (uri, args)
3883
- --- return ngx.location.capture_multi({ {uri, args} })
3884
- --- end
3885
- --- ```
3886
- ---
3887
- --- Please also refer to restrictions on capturing locations configured by subrequest directives of other modules.
3888
- ---
3889
- ---@param args ngx.location.capture.arg[]
3890
- ---@return ngx.location.capture.response ...
3891
- function ngx.location.capture_multi(args) end
3892
-
3893
- --- Set, add to, or clear the current request's `HEADER` response header that is to be sent.
3894
- ---
3895
- --- Underscores (`_`) in the header names will be replaced by hyphens (`-`) by default. This transformation can be turned off via the `lua_transform_underscores_in_response_headers` directive.
3896
- ---
3897
- --- The header names are matched case-insensitively.
3898
- ---
3899
- --- ```lua
3900
- --- -- equivalent to ngx.header["Content-Type"] = 'text/plain'
3901
- --- ngx.header.content_type = 'text/plain';
3902
- ---
3903
- --- ngx.header["X-My-Header"] = 'blah blah';
3904
- --- ```
3905
- ---
3906
- --- Multi-value headers can be set this way:
3907
- ---
3908
- --- ```lua
3909
- --- ngx.header['Set-Cookie'] = {'a=32; path=/', 'b=4; path=/'}
3910
- --- ```
3911
- ---
3912
- --- will yield
3913
- ---
3914
- --- ```bash
3915
- --- Set-Cookie: a=32; path=/
3916
- --- Set-Cookie: b=4; path=/
3917
- --- ```
3918
- ---
3919
- --- in the response headers.
3920
- ---
3921
- --- Only Lua tables are accepted (Only the last element in the table will take effect for standard headers such as `Content-Type` that only accept a single value).
3922
- ---
3923
- --- ```lua
3924
- --- ngx.header.content_type = {'a', 'b'}
3925
- --- ```
3926
- ---
3927
- --- is equivalent to
3928
- ---
3929
- --- ```lua
3930
- --- ngx.header.content_type = 'b'
3931
- --- ```
3932
- ---
3933
- --- Setting a slot to `nil` effectively removes it from the response headers:
3934
- ---
3935
- --- ```lua
3936
- --- ngx.header["X-My-Header"] = nil;
3937
- --- ```
3938
- ---
3939
- --- The same applies to assigning an empty table:
3940
- ---
3941
- --- ```lua
3942
- --- ngx.header["X-My-Header"] = {};
3943
- --- ```
3944
- ---
3945
- --- Setting `ngx.header.HEADER` after sending out response headers (either explicitly with `ngx.send_headers` or implicitly with `ngx.print` and similar) will log an error message.
3946
- ---
3947
- --- Reading `ngx.header.HEADER` will return the value of the response header named `HEADER`.
3948
- ---
3949
- --- Underscores (`_`) in the header names will also be replaced by dashes (`-`) and the header names will be matched case-insensitively. If the response header is not present at all, `nil` will be returned.
3950
- ---
3951
- --- This is particularly useful in the context of `header_filter_by_lua*`, for example:
3952
- ---
3953
- --- ```nginx
3954
- --- location /test {
3955
- --- set $footer '';
3956
- ---
3957
- --- proxy_pass http://some-backend;
3958
- ---
3959
- --- header_filter_by_lua_block {
3960
- --- if ngx.header["X-My-Header"] == "blah" then
3961
- --- ngx.var.footer = "some value"
3962
- --- end
3963
- --- }
3964
- ---
3965
- --- echo_after_body $footer;
3966
- --- }
3967
- --- ```
3968
- ---
3969
- --- For multi-value headers, all of the values of header will be collected in order and returned as a Lua table. For example, response headers
3970
- ---
3971
- --- Foo: bar
3972
- --- Foo: baz
3973
- ---
3974
- --- will result in
3975
- ---
3976
- --- ```lua
3977
- --- {"bar", "baz"}
3978
- --- ```
3979
- ---
3980
- --- to be returned when reading `ngx.header.Foo`.
3981
- ---
3982
- --- Note that `ngx.header` is not a normal Lua table and as such, it is not possible to iterate through it using the Lua `ipairs` function.
3983
- ---
3984
- --- Note: `HEADER` and `VALUE` will be truncated if they
3985
- --- contain the `\r` or `\n` characters. The truncated values
3986
- --- will contain all characters up to (and excluding) the first occurrence of
3987
- --- `\r` or `\n`.
3988
- ---
3989
- --- For reading *request* headers, use the `ngx.req.get_headers` function instead.
3990
- ---
3991
- ---@type table<string, string|string[]|nil>
3992
- ngx.header = {}
3993
-
3994
- --- Parse the http time string (as returned by `ngx.http_time`) into seconds. Returns the seconds or `nil` if the input string is in bad forms.
3995
- ---
3996
- --- ```lua
3997
- --- local time = ngx.parse_http_time("Thu, 18 Nov 2010 11:27:35 GMT")
3998
- --- if time == nil then
3999
- --- ...
4000
- --- end
4001
- --- ```
4002
- ---
4003
- ---@param str string
4004
- ---@return number?
4005
- function ngx.parse_http_time(str) end
4006
-
4007
- --- Returns a formated string can be used as the http header time (for example, being used in `Last-Modified` header). The parameter `sec` is the time stamp in seconds (like those returned from `ngx.time`).
4008
- ---
4009
- --- ```lua
4010
- --- ngx.say(ngx.http_time(1290079655))
4011
- --- -- yields "Thu, 18 Nov 2010 11:27:35 GMT"
4012
- --- ```
4013
- ---
4014
- ---@param sec number
4015
- ---@return string
4016
- function ngx.http_time(sec) end
4017
-
4018
- --- Sleeps for the specified seconds without blocking. One can specify time resolution up to 0.001 seconds (i.e., one milliseconds).
4019
- ---
4020
- --- Behind the scene, this method makes use of the NGINX timers.
4021
- ---
4022
- --- The `0` time argument can also be specified.
4023
- ---
4024
- ---@param seconds number
4025
- function ngx.sleep(seconds) end
4026
-
4027
- --- Forcibly updates the NGINX current time cache. This call involves a syscall and thus has some overhead, so do not abuse it.
4028
- ---
4029
- function ngx.update_time() end
4030
-
4031
- --- Returns a floating-point number for the elapsed time in seconds (including milliseconds as the decimal part) from the epoch for the current time stamp from the NGINX cached time (no syscall involved unlike Lua's date library).
4032
- ---
4033
- --- You can forcibly update the NGINX time cache by calling `ngx.update_time` first.
4034
- ---
4035
- ---@return number
4036
- function ngx.now() end
4037
-
4038
- --- Returns the current time stamp (in the format `yyyy-mm-dd hh:mm:ss`) of the NGINX cached time (no syscall involved unlike Lua's `os.date` function).
4039
- ---
4040
- ---@return string
4041
- function ngx.localtime() end
4042
-
4043
- --- Returns the current time stamp (in the format `yyyy-mm-dd hh:mm:ss`) of the NGINX cached time (no syscall involved unlike Lua's `os.date` function).
4044
- ---
4045
- ---@return string
4046
- function ngx.utctime() end
4047
-
4048
- --- Returns a formatted string can be used as the cookie expiration time. The parameter `sec` is the time stamp in seconds (like those returned from `ngx.time`).
4049
- ---
4050
- --- ```lua
4051
- --- ngx.say(ngx.cookie_time(1290079655))
4052
- --- -- yields "Thu, 18-Nov-10 11:27:35 GMT"
4053
- --- ```
4054
- ---
4055
- ---@param sec number
4056
- ---@return string
4057
- function ngx.cookie_time(sec) end
4058
-
4059
- --- Returns current date (in the format `yyyy-mm-dd`) from the NGINX cached time (no syscall involved unlike Lua's date library).
4060
- ---
4061
- --- This uses the local timezone.
4062
- ---
4063
- ---@return string
4064
- function ngx.today() end
4065
-
4066
- --- Returns the elapsed seconds from the epoch for the current time stamp from the NGINX cached time (no syscall involved unlike Lua's date library).
4067
- ---
4068
- --- Updates of the NGINX time cache can be forced by calling `ngx.update_time` first.
4069
- ---
4070
- ---@return integer
4071
- function ngx.time() end
4072
-
4073
- --- Log arguments concatenated to error.log with the given logging level.
4074
- ---
4075
- --- Lua `nil` arguments are accepted and result in literal `"nil"` string while Lua booleans result in literal `"true"` or `"false"` string outputs. And the `ngx.null` constant will yield the `"null"` string output.
4076
- ---
4077
- --- The `level` argument can take constants like `ngx.ERR` and `ngx.WARN`.
4078
- ---
4079
- --- There is a hard coded `2048` byte limitation on error message lengths in the NGINX core. This limit includes trailing newlines and leading time stamps. If the message size exceeds this limit, NGINX will truncate the message text accordingly. This limit can be manually modified by editing the `NGX_MAX_ERROR_STR` macro definition in the `src/core/ngx_log.h` file in the NGINX source tree.
4080
- ---
4081
- ---@param level ngx.log.level
4082
- ---@param ... any
4083
- function ngx.log(level, ...) end
4084
-
4085
- --- Explicitly specify the end of the response output stream. In the case of HTTP 1.1 chunked encoded output, it will just trigger the NGINX core to send out the "last chunk".
4086
- ---
4087
- --- When you disable the HTTP 1.1 keep-alive feature for your downstream connections, you can rely on well written HTTP clients to close the connection actively for you when you call this method. This trick can be used do back-ground jobs without letting the HTTP clients to wait on the connection, as in the following example:
4088
- ---
4089
- --- ```nginx
4090
- --- location = /async {
4091
- --- keepalive_timeout 0;
4092
- --- content_by_lua_block {
4093
- --- ngx.say("got the task!")
4094
- --- ngx.eof() -- well written HTTP clients will close the connection at this point
4095
- --- -- access MySQL, PostgreSQL, Redis, Memcached, and etc here...
4096
- --- }
4097
- --- }
4098
- --- ```
4099
- ---
4100
- --- But if you create subrequests to access other locations configured by NGINX upstream modules, then you should configure those upstream modules to ignore client connection abortions if they are not by default. For example, by default the standard `ngx_http_proxy_module` will terminate both the subrequest and the main request as soon as the client closes the connection, so it is important to turn on the `proxy_ignore_client_abort` directive in your location block configured by `ngx_http_proxy_module`://nginx.org/en/docs/http/ngx_http_proxy_module.html):
4101
- ---
4102
- --- ```nginx
4103
- --- proxy_ignore_client_abort on;
4104
- --- ```
4105
- ---
4106
- --- A better way to do background jobs is to use the `ngx.timer.at` API.
4107
- ---
4108
- --- Returns `1` on success, or returns `nil` and a string describing the error otherwise.
4109
- ---
4110
- ---@return boolean ok
4111
- ---@return string? error
4112
- function ngx.eof() end
4113
-
4114
- --- Emits arguments concatenated to the HTTP client (as response body). If response headers have not been sent, this function will send headers out first and then output body data.
4115
- ---
4116
- --- Returns `1` on success, or returns `nil` and a string describing the error otherwise.
4117
- ---
4118
- --- Lua `nil` values will output `"nil"` strings and Lua boolean values will output `"true"` and `"false"` literal strings respectively.
4119
- ---
4120
- --- Nested arrays of strings are permitted and the elements in the arrays will be sent one by one:
4121
- ---
4122
- --- ```lua
4123
- --- local table = {
4124
- --- "hello, ",
4125
- --- {"world: ", true, " or ", false,
4126
- --- {": ", nil}}
4127
- --- }
4128
- --- ngx.print(table)
4129
- --- ```
4130
- ---
4131
- --- will yield the output
4132
- ---
4133
- --- ```bash
4134
- --- hello, world: true or false: nil
4135
- --- ```
4136
- ---
4137
- --- Non-array table arguments will cause a Lua exception to be thrown.
4138
- ---
4139
- --- The `ngx.null` constant will yield the `"null"` string output.
4140
- ---
4141
- --- This is an asynchronous call and will return immediately without waiting for all the data to be written into the system send buffer. To run in synchronous mode, call `ngx.flush(true)` after calling `ngx.print`. This can be particularly useful for streaming output. See `ngx.flush` for more details.
4142
- ---
4143
- --- Please note that both `ngx.print` and `ngx.say` will always invoke the whole NGINX output body filter chain, which is an expensive operation. So be careful when calling either of these two in a tight loop; buffer the data yourself in Lua and save the calls.
4144
- ---
4145
- ---@param ... string|string[]
4146
- ---@return boolean ok
4147
- ---@return string? error
4148
- function ngx.print(...) end
4149
-
4150
- --- Just as `ngx.print` but also emit a trailing newline.
4151
- ---
4152
- ---@param ... string|string[]
4153
- ---@return boolean ok
4154
- ---@return string? error
4155
- function ngx.say(...) end
4156
-
4157
- --- Explicitly send out the response headers.
4158
- ---
4159
- --- Returns `1` on success, or returns `nil` and a string describing the error otherwise.
4160
- ---
4161
- --- Note that there is normally no need to manually send out response headers as ngx_lua will automatically send headers out before content is output with `ngx.say` or `ngx.print` or when `content_by_lua*` exits normally.
4162
- ---
4163
- ---@return boolean ok
4164
- ---@return string? error
4165
- function ngx.send_headers() end
4166
-
4167
- --- Flushes response output to the client.
4168
- ---
4169
- --- `ngx.flush` accepts an optional boolean `wait` argument (Default: `false`). When called with the default argument, it issues an asynchronous call (Returns immediately without waiting for output data to be written into the system send buffer). Calling the function with the `wait` argument set to `true` switches to synchronous mode.
4170
- ---
4171
- --- In synchronous mode, the function will not return until all output data has been written into the system send buffer or until the `send_timeout` setting has expired. Note that using the Lua coroutine mechanism means that this function does not block the NGINX event loop even in the synchronous mode.
4172
- ---
4173
- --- When `ngx.flush(true)` is called immediately after `ngx.print` or `ngx.say`, it causes the latter functions to run in synchronous mode. This can be particularly useful for streaming output.
4174
- ---
4175
- --- Note that `ngx.flush` is not functional when in the HTTP 1.0 output buffering mode. See `HTTP 1.0 support`.
4176
- ---
4177
- --- Returns `1` on success, or returns `nil` and a string describing the error otherwise.
4178
- ---
4179
- ---@param wait? boolean
4180
- ---@return boolean ok
4181
- ---@return string? error
4182
- function ngx.flush(wait) end
4183
-
4184
- --- NGINX response methods
4185
- ngx.resp = {}
4186
-
4187
- --- Returns a Lua table holding all the current response headers for the current request.
4188
- ---
4189
- --- ```lua
4190
- --- local h, err = ngx.resp.get_headers()
4191
- ---
4192
- --- if err == "truncated" then
4193
- --- -- one can choose to ignore or reject the current response here
4194
- --- end
4195
- ---
4196
- --- for k, v in pairs(h) do
4197
- --- ...
4198
- --- end
4199
- --- ```
4200
- ---
4201
- --- This function has the same signature as `ngx.req.get_headers` except getting response headers instead of request headers.
4202
- ---
4203
- --- Note that a maximum of 100 response headers are parsed by default (including those with the same name) and that additional response headers are silently discarded to guard against potential denial of service attacks. When the limit is exceeded, it will return a second value which is the string `"truncated"`.
4204
- ---
4205
- ---@param max_headers? number
4206
- ---@param raw? boolean
4207
- ---@return table<string, string|string[]>
4208
- ---@return string|'"truncated"' error
4209
- function ngx.resp.get_headers(max_headers, raw) end
4210
-
4211
- ---@alias ngx.thread.arg boolean|number|integer|string|lightuserdata|table
4212
-
4213
- ---**syntax:** *ok, res1, res2, ... = ngx.run_worker_thread(threadpool, module_name, func_name, arg1, arg2, ...)*
4214
- ---
4215
- ---**context:** *rewrite_by_lua&#42;, access_by_lua&#42;, content_by_lua&#42;*
4216
- ---
4217
- ---**This API is still experimental and may change in the future without notice.**
4218
- ---
4219
- ---**This API is available only for Linux.**
4220
- ---
4221
- ---Wrap the [nginx worker thread](http://nginx.org/en/docs/dev/development_guide.html#threads) to execute lua function. The caller coroutine would yield until the function returns.
4222
- ---
4223
- ---Only the following ngx_lua APIs could be used in `function_name` function of the `module` module:
4224
- ---
4225
- ---* `ngx.encode_base64`
4226
- ---* `ngx.decode_base64`
4227
- ---
4228
- ---* `ngx.hmac_sha1`
4229
- ---* `ngx.encode_args`
4230
- ---* `ngx.decode_args`
4231
- ---* `ngx.quote_sql_str`
4232
- ---
4233
- ---* `ngx.re.match`
4234
- ---* `ngx.re.find`
4235
- ---* `ngx.re.gmatch`
4236
- ---* `ngx.re.sub`
4237
- ---* `ngx.re.gsub`
4238
- ---
4239
- ---* `ngx.crc32_short`
4240
- ---* `ngx.crc32_long`
4241
- ---* `ngx.hmac_sha1`
4242
- ---* `ngx.md5_bin`
4243
- ---* `ngx.md5`
4244
- ---
4245
- ---* `ngx.config.subsystem`
4246
- ---* `ngx.config.debug`
4247
- ---* `ngx.config.prefix`
4248
- ---* `ngx.config.nginx_version`
4249
- ---* `ngx.config.nginx_configure`
4250
- ---* `ngx.config.ngx_lua_version`
4251
- ---
4252
- ---
4253
- ---The first argument `threadpool` specifies the Nginx thread pool name defined by [thread_pool](https://nginx.org/en/docs/ngx_core_module.html#thread_pool).
4254
- ---
4255
- ---The second argument `module_name` specifies the lua module name to execute in the worker thread, which would return a lua table. The module must be inside the package path, e.g.
4256
- ---
4257
- ---```nginx
4258
- ---
4259
- ---lua_package_path '/opt/openresty/?.lua;;';
4260
- ---```
4261
- ---
4262
- ---The third argument `func_name` specifies the function field in the module table as the second argument.
4263
- ---
4264
- ---The type of `arg`s must be one of type below:
4265
- ---
4266
- ---* boolean
4267
- ---* number
4268
- ---* string
4269
- ---* nil
4270
- ---* table (the table may be recursive, and contains members of types above.)
4271
- ---
4272
- ---The `ok` is in boolean type, which indicate the C land error (failed to get thread from thread pool, pcall the module function failed, .etc). If `ok` is `false`, the `res1` is the error string.
4273
- ---
4274
- ---The return values (res1, ...) are returned by invocation of the module function. Normally, the `res1` should be in boolean type, so that the caller could inspect the error.
4275
- ---
4276
- ---This API is useful when you need to execute the below types of tasks:
4277
- ---
4278
- ---* CPU bound task, e.g. do md5 calculation
4279
- ---* File I/O task
4280
- ---* Call `os.execute()` or blocking C API via `ffi`
4281
- ---* Call external Lua library not based on cosocket or nginx
4282
- ---
4283
- ---Example1: do md5 calculation.
4284
- ---
4285
- ---```nginx
4286
- ---
4287
- ---location /calc_md5 {
4288
- --- default_type 'text/plain';
4289
- ---
4290
- --- content_by_lua_block {
4291
- --- local ok, md5_or_err = ngx.run_worker_thread("testpool", "md5", "md5")
4292
- --- ngx.say(ok, " : ", md5_or_err)
4293
- --- }
4294
- --- }
4295
- ---```
4296
- ---
4297
- ---`md5.lua`
4298
- ---
4299
- ---```lua
4300
- ---local function md5()
4301
- --- return ngx.md5("hello")
4302
- ---end
4303
- ---```
4304
- ---
4305
- ---Example2: write logs into the log file.
4306
- ---
4307
- ---```nginx
4308
- ---
4309
- ---location /write_log_file {
4310
- --- default_type 'text/plain';
4311
- ---
4312
- --- content_by_lua_block {
4313
- --- local ok, err = ngx.run_worker_thread("testpool", "write_log_file", "log", ngx.var.arg_str)
4314
- --- if not ok then
4315
- --- ngx.say(ok, " : ", err)
4316
- --- return
4317
- --- end
4318
- --- ngx.say(ok)
4319
- --- }
4320
- --- }
4321
- ---```
4322
- ---
4323
- ---`write_log_file.lua`
4324
- ---
4325
- ---```lua
4326
- ---
4327
- --- local function log(str)
4328
- --- local file, err = io.open("/tmp/tmp.log", "a")
4329
- --- if not file then
4330
- --- return false, err
4331
- --- end
4332
- --- file:write(str)
4333
- --- file:flush()
4334
- --- file:close()
4335
- --- return true
4336
- --- end
4337
- --- return {log=log}
4338
- ---```
4339
- ---
4340
- ---@param threadpool string
4341
- ---@param module_name string
4342
- ---@param func_name string
4343
- ---@param arg1? ngx.thread.arg
4344
- ---@param arg2? ngx.thread.arg
4345
- ---@param ... ngx.thread.arg
4346
- ---@return boolean ok
4347
- ---@return ngx.thread.arg? result_or_error
4348
- ---@return any ...
4349
- function ngx.run_worker_thread(threadpool, module_name, func_name, arg1, arg2, ...) end
4350
-
4351
- return ngx