added nvchand base setup

This commit is contained in:
filippo-ferrari 2024-01-27 17:26:04 +01:00
parent 29fb993d4f
commit 46328867e0
1249 changed files with 552433 additions and 167 deletions

161
.config/nvim/.github/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,161 @@
# [CONTRIBUTING](https://nvchad.github.io/contribute)
## NvChad install for contributors
If you wish to contribute to NvChad, you should:
1. [create a fork on GitHub](https://docs.github.com/en/get-started/quickstart/fork-a-repo)
2. clone your fork to your machine
- For ssh:
```shell
$ git clone git@github.com:<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
```
- For https:
```shell
$ git clone https://github.com/<YOUR GITHUB USERNAME>/NvChad.git ~/.config/nvim
```
3. [add a new remote repo to track](https://www.atlassian.com/git/tutorials/git-forks-and-upstreams)
- this means you can push/pull as normal to your own repo, but also easily track & update from the NvChad repo
- for ssh:
```shell
$ git remote add upstream git@github.com:NvChad/NvChad.git
```
- for https:
```shell
$ git remote add upstream https://github.com/NvChad/NvChad.git
```
4. any time you create a branch to do some work, use
```shell
$ git fetch upstream && git checkout -b dev-myFEAT upstream/main
```
5. only use the **--rebase** flag to update your dev branch
- this means that there are no `Merge NvChad/main into devBranch` commits, which are to be avoided
```shell
$ git pull upstream --rebase
```
## Things to know before contributing
- When making a PR (pull request), please be very descriptive about what you've done!
- PR titles should be formatted with 'fix', 'chore' or 'feat'. ex: `feat: add new plugin`
- PRs should follow the pull request formats where applicable
- We are open to all PRs, but may decline some for a myriad of reasons. Though don't be discouraged! We'll still be open to discussions.
- PR's are always welcomed however NvChad aims to be less bloated. So PR's regarding existing plugin's enhancement and creating new features with existing plugins itself ( without adding a new plugin), bug fixes and corrections are more encouraged.
- NvChad won't keep adding more and more features (like adding new plugins most likely) as requested if they feel unneeded and aren't usable by the majority!! If you think the plugin you want to be added is very useful and many NvChaders would find it useful, then such feature's PR is welcomed!
- But adding specific features like adding config for [wakatime](https://github.com/wakatime/vim-wakatime) etc will be added in this [chad user configs](https://github.com/NvChad/NvChad/wiki/Chad-user-configs). This lets the user select the things only they want ( adding configs from extra configs ).
## How to remove or edit commits from your PR
> You may have been directed here to remove a commit such as a merge commit: `Merge NvChad/main into devBranch` from your PR
> As these commands edit your git history, you may need to **force push** with `git push origin --force`
1. Run the following:
```
$ git rebase -i HEAD~<NUMBER OF COMMITS TO GO BACK>
```
<details><summary>Example</summary>
<p>
```shell
$ git rebase -i HEAD~4
```
```shell
pick 28b2dcb statusline add lsp status
pick dad9a39 feat: Added lsp radial progress
pick 68f72f1 add clickable btn for exiting nvim
pick b281b53 avoid using q! for quitting vim
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</p>
</details>
2. Change the `pick` commands to whatever you wish, you may wish to `d` `drop` or `e` `edit` a commit. Then save & quit this git file to run it.
<details><summary>Example</summary>
<p>
```shell {3,4}
pick 28b2dcb statusline add lsp status
pick dad9a39 feat: Added lsp radial progress
edit 68f72f1 add clickable btn for exiting nvim
d b281b53 avoid using q! for quitting vim
# Rebase 52b655b..b281b53 onto 52b655b (4 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup <commit> = like "squash", but discard this commit's log message
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
# . create a merge commit using the original merge commit's
# . message (or the oneline, if no original merge commit was
# . specified). Use -c <commit> to reword the commit message.
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
```
</p>
</details>
3. If you picked `drop` you are done, if you picked `edit` then edit your files, then run:
```shell
$ git add <files>
```
4. Once you have edited & added your files, run:
```shell
$ git rebase --continue
```
5. You will likely need to push using:
```shell
$ git push origin --force
```
## Help
For help with contributing and anything else nvChad related join the [discord](https://discord.gg/VyPxsGArXc)

3
.config/nvim/.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,3 @@
patreon: siduck
ko_fi: siduck
custom: ["https://www.buymeacoffee.com/siduck", "https://www.paypal.com/paypalme/siduck76"]

View file

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- Before reporting: update nvchad to the latest version,read breaking changes page,search existing issues. -->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- Operating System
- Terminal
- Version of Neovim
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Wiki
url: https://github.com/siduck76/NvChad/wiki
about: "Walks you through how to use and Configure NvChad."
- name: Visit our gitter chat
url: https://gitter.im/neovim-dotfiles/community
about: "A place where we dicuss NvChad related stuff."

View file

@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem was.
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
**Screenshot**
Maybe a screenshot of the feature

View file

@ -0,0 +1,14 @@
Fixes Issue # (If it doesn't fix an issue then delete this line)
Features Added:
- Plugin Name (Add links if possible too)
Reasoning:
List why the feature is needed
Speed (If applicable):
Show the impact on the speed of nvChad
Other:
Anything else relevant goes here

View file

@ -0,0 +1,16 @@
(Make sure your title is either: 'fix', 'chore', or 'feat' then your title. ex: `fix: add new plugin`)
Fixes Issue # (If it doesn't fix an issue then delete this line)
Plugins Added:
- [Plugin Name](Plugin Link)
- [Plugin Name](Plugin Link)
Reasoning:
List why the plugin(s) should be added
Speed:
Show the impact on the speed of nvChad
Other:
Anything else relevant goes here

122
.config/nvim/.github/README.md vendored Normal file
View file

@ -0,0 +1,122 @@
<h1 align="center">NvChad</h1>
<div align="center">
<a href="https://nvchad.com/">Home</a>
<span></span>
<a href="https://nvchad.com/docs/quickstart/install">Install</a>
<span></span>
<a href="https://nvchad.com/docs/contribute">Contribute</a>
<span></span>
<a href="https://github.com/NvChad/NvChad#gift_heart-support">Support</a>
<span></span>
<a href="https://nvchad.com/docs/features">Features</a>
<p></p>
</div>
<div align="center">
[![Neovim Minimum Version](https://img.shields.io/badge/Neovim-0.9.0-blueviolet.svg?style=flat-square&logo=Neovim&color=90E59A&logoColor=white)](https://github.com/neovim/neovim)
[![GitHub Issues](https://img.shields.io/github/issues/NvChad/NvChad.svg?style=flat-square&label=Issues&color=d77982)](https://github.com/NvChad/NvChad/issues)
[![Discord](https://img.shields.io/discord/869557815780470834?color=738adb&label=Discord&logo=discord&logoColor=white&style=flat-square)](https://discord.gg/gADmkJb9Fb)
[![Matrix](https://img.shields.io/badge/Matrix-40aa8b.svg?style=flat-square&logo=Matrix&logoColor=white)](https://matrix.to/#/#nvchad:matrix.org)
[![Telegram](https://img.shields.io/badge/Telegram-blue.svg?style=flat-square&logo=Telegram&logoColor=white)](https://t.me/DE_WM)
</div>
## Showcase
<img src="https://nvchad.com/features/nvdash.webp">
<img src="https://nvchad.com/banner.webp">
<img src="https://nvchad.com/screenshots/onedark.webp">
<img src="https://nvchad.com/screenshots/rxyhn1.webp">
## What is it?
- NvChad is a neovim config written in lua aiming to provide a base configuration with very beautiful UI and blazing fast startuptime (around 0.02 secs ~ 0.07 secs). We tweak UI plugins such as telescope, nvim-tree, bufferline etc well to provide an aesthetic UI experience.
- Lazy loading is done 93% of the time meaning that plugins will not be loaded by default, they will be loaded only when required also at specific commands, events etc. This lowers the startuptime and it was like 0.07~ secs tested on an old pentium machine 1.4ghz + 4gb ram & HDD.
- NvChad isn't a framework! It's supposed to be used as a "base" config, so users can tweak the defaults well, and also remove the things they don't like in the default config and build their config on top of it. Users can tweak the entire default config while staying in their custom config (lua/custom dir). This is the control center of the user's config and gitignored so the users can stay up-to-date with NvChad's latest config (main branch) while still controlling it with their chadrc (file that controls entire custom dir).
## Theme Showcase
<details><summary> <b>Images (Click to expand!)</b></summary>
![4 themes](https://nvchad.com/screenshots/four_Themes.webp)
![radium 1](https://nvchad.com/screenshots/radium1.webp)
![radium 2](https://nvchad.com/screenshots/radium2.webp)
![radium 3](https://nvchad.com/screenshots/radium3.webp)
(Note: these are just 4-5 themes, NvChad has around 56 themes)
</details>
## UI related plugins used
<details><summary> <b>Images (Click to expand!)</b></summary>
<h3> Nvim-tree.lua </h3>
Fast file tree:
<kbd><img src="https://nvchad.com/features/nvimtree.webp"></kbd>
<h3> Telescope-nvim </h3>
A fuzzy file finder, picker, sorter, previewer and much more:
<kbd><img src="https://nvchad.com/features/telescope.webp"></kbd>
<h3> Our own statusline written from scratch </h3>
[NvChad UI](https://github.com/NvChad/ui)
<kbd><img src="https://nvchad.com/features/statuslines.webp"></kbd>
<h3> Tabufline (our own pertab bufferline) </h3>
<kbd><img src="https://nvchad.com/features/tabufline.webp"></kbd>
- Here's a [video](https://www.youtube.com/watch?v=V_9iJ96U_k8&ab_channel=siduck) that showcases it.
<h3> NvCheatsheet ( our UI Plugin ) </h3>
<kbd> <img src="https://nvchad.com/features/nvcheatsheet.webp"/></kbd>
</details>
## Plugins list
- Many beautiful themes, theme toggler by our [base46 plugin](https://github.com/NvChad/base46)
- Inbuilt terminal toggling & management with [Nvterm](https://github.com/NvChad/nvterm)
- Lightweight & performant ui plugin with [NvChad UI](https://github.com/NvChad/ui) It provides statusline modules, tabufline ( tabs + buffer manager) , beautiful cheatsheets, NvChad updater, hide & unhide terminal buffers, theme switcher and much more!
- File navigation with [nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua)
- Beautiful and configurable icons with [nvim-web-devicons](https://github.com/kyazdani42/nvim-web-devicons)
- Git diffs and more with [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)
- NeoVim Lsp configuration with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) and [mason.nvim](https://github.com/williamboman/mason.nvim)
- Autocompletion with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
- File searching, previewing image and text files and more with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim).
- Syntax highlighting with [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter)
- Autoclosing braces and html tags with [nvim-autopairs](https://github.com/windwp/nvim-autopairs)
- Indentlines with [indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim)
- Useful snippets with [friendly snippets](https://github.com/rafamadriz/friendly-snippets) + [LuaSnip](https://github.com/L3MON4D3/LuaSnip).
- Popup mappings keysheet [whichkey.nvim](https://github.com/folke/which-key.nvim)
## History
- I (@siduck i.e creator of NvChad) in my initial days of learning to program wanted a lightweight IDE for writing code, I had a very low end system which was like 1.4ghz pentium + 4gb ram & HDD. I was into web dev stuff so many suggested me to use vscode but that thing was very heavy on my system, It took more ram than my browser! ( minimal ungoogled chromium ) so I never tried it again, sublime text was nice but the fear of using proprietary software XD for a linux user bugged me a lot. Then I tried doom-emacs which looked pretty but it was slow and I was lost within its docs, I tried lunarvim but too lazy to read the docs. Doom-emacs and lunarvim inspired me to make a config which is the prettiest + very fast and simple.
- I'm decent at ricing i.e customizing system and making it look pretty so I posted my neovim rice on [neovim subreddit](https://www.reddit.com/r/neovim/comments/m3xl4f/neovim_rice/), my neovim-dotfiles github repo blew up and then I had to come up with a name, I was amazed by the chad meme lol so I put NvChad as the name, the chad word in here doesnt literally mean the chad guy but in the sense such as chad linux vs windows i.e meaning superior, best etc. NvChad was made for my personal use but it gained some popularity which inspired me to make a public config i.e config usable by many and less hassle to update as everyone's going to use the same base config (NvChad) with their custom modifications (which are gitignored so that wont mess up), without the custom config stuff users would have to keep a track of every commit and copy paste git diffs to manually update nvchad.
## :gift_heart: Support
If you like NvChad and would like to support & appreciate it via donation then I'll gladly accept it.
[![kofi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/siduck)
[![paypal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/siduck13)
[![buymeacoffee](https://img.shields.io/badge/Buy_Me_A_Coffee-FFDD00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black)](https://www.buymeacoffee.com/siduck)
[![patreon](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/siduck)
## Credits
- [Elianiva](https://github.com/elianiva) helped me with NeoVim Lua related issues many times, NvChad wouldn't exist without his help at all as he helped me in my initial neovim journey!
- @lorvethe for making the beautiful NvChad logo.

View file

@ -0,0 +1,22 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.'
close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.'
exempt-all-issue-assignees: true # doesn't close an issue if someone was assigned to it.
close-pr-message: 'This PR was closed because it has been stalled for 10 days with no activity.'
exempt-all-pr-assignees: true # doesn't close a pr if someone was assigned to it.
days-before-issue-stale: 30
days-before-pr-stale: 45
days-before-issue-close: 5
days-before-pr-close: 10

10
.config/nvim/.gitignore vendored Normal file
View file

@ -0,0 +1,10 @@
plugin
custom
spell
ftplugin
syntax
coc-settings.json
.luarc.json
lazy-lock.json
after
**/.DS_Store

1
.config/nvim/.ignore Normal file
View file

@ -0,0 +1 @@
!/lua/custom/

View file

@ -0,0 +1,6 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"

674
.config/nvim/LICENSE Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

21
.config/nvim/init.lua Normal file
View file

@ -0,0 +1,21 @@
require "core"
local custom_init_path = vim.api.nvim_get_runtime_file("lua/custom/init.lua", false)[1]
if custom_init_path then
dofile(custom_init_path)
end
require("core.utils").load_mappings()
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
-- bootstrap lazy.nvim!
if not vim.loop.fs_stat(lazypath) then
require("core.bootstrap").gen_chadrc_template()
require("core.bootstrap").lazy(lazypath)
end
dofile(vim.g.base46_cache .. "defaults")
vim.opt.rtp:prepend(lazypath)
require "plugins"

View file

@ -1,167 +0,0 @@
let mapleader =","
if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
echo "Downloading junegunn/vim-plug to manage plugins..."
silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
autocmd VimEnter * PlugInstall
endif
map ,, :keepp /<++><CR>ca<
imap ,, <esc>:keepp /<++><CR>ca<
call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'junegunn/goyo.vim'
Plug 'jreybert/vimagit'
Plug 'vimwiki/vimwiki'
Plug 'vim-airline/vim-airline'
Plug 'tpope/vim-commentary'
Plug 'ap/vim-css-color'
call plug#end()
set title
set bg=light
set go=a
set mouse=a
set nohlsearch
set clipboard+=unnamedplus
set noshowmode
set noruler
set laststatus=0
set noshowcmd
" Some basics:
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
" Enable autocompletion:
set wildmode=longest,list,full
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Perform dot commands over visual blocks:
vnoremap . :normal .<CR>
" Goyo plugin makes text more readable when writing prose:
map <leader>f :Goyo \| set bg=light \| set linebreak<CR>
" Spell-check set to <leader>o, 'o' for 'orthography':
map <leader>o :setlocal spell! spelllang=en_us<CR>
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
set splitbelow splitright
" Nerd tree
map <leader>n :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
if has('nvim')
let NERDTreeBookmarksFile = stdpath('data') . '/NERDTreeBookmarks'
else
let NERDTreeBookmarksFile = '~/.vim' . '/NERDTreeBookmarks'
endif
" vimling:
nm <leader>d :call ToggleDeadKeys()<CR>
imap <leader>d <esc>:call ToggleDeadKeys()<CR>a
nm <leader>i :call ToggleIPA()<CR>
imap <leader>i <esc>:call ToggleIPA()<CR>a
nm <leader>q :call ToggleProse()<CR>
" vim-airline
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.colnr = ' C:'
let g:airline_symbols.linenr = ' L:'
let g:airline_symbols.maxlinenr = '☰ '
" Shortcutting split navigation, saving a keypress:
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
" Replace ex mode with gq
map Q gq
" Check file in shellcheck:
map <leader>s :!clear && shellcheck -x %<CR>
" Open my bibliography file in split
map <leader>b :vsp<space>$BIB<CR>
map <leader>r :vsp<space>$REFER<CR>
" Replace all is aliased to S.
nnoremap S :%s//g<Left><Left>
" Compile document, be it groff/LaTeX/markdown/etc.
map <leader>c :w! \| !compiler "%:p"<CR>
" Open corresponding .pdf/.html or preview
map <leader>p :!opout "%:p"<CR>
" Runs a script that cleans out tex build files whenever I close out of a .tex file.
autocmd VimLeave *.tex !texclear %
" Ensure files are read as what I want:
let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
map <leader>v :VimwikiIndex<CR>
let g:vimwiki_list = [{'path': '~/.local/share/nvim/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
autocmd BufRead,BufNewFile *.tex set filetype=tex
" Save file as sudo on files that require root permission
cabbrev w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!
" Enable Goyo by default for mutt writing
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo | set bg=light
autocmd BufRead,BufNewFile /tmp/neomutt* map ZZ :Goyo\|x!<CR>
autocmd BufRead,BufNewFile /tmp/neomutt* map ZQ :Goyo\|q!<CR>
" Automatically deletes all trailing whitespace and newlines at end of file on save. & reset cursor position
autocmd BufWritePre * let currPos = getpos(".")
autocmd BufWritePre * %s/\s\+$//e
autocmd BufWritePre * %s/\n\+\%$//e
autocmd BufWritePre *.[ch] %s/\%$/\r/e " add trailing newline for ANSI C standard
autocmd BufWritePre *neomutt* %s/^--$/-- /e " dash-dash-space signature delimiter in emails
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
" When shortcut files are updated, renew bash and ranger configs with new material:
autocmd BufWritePost bm-files,bm-dirs !shortcuts
" Run xrdb whenever Xdefaults or Xresources are updated.
autocmd BufRead,BufNewFile Xresources,Xdefaults,xresources,xdefaults set filetype=xdefaults
autocmd BufWritePost Xresources,Xdefaults,xresources,xdefaults !xrdb %
" Recompile dwmblocks on config edit.
autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid -f dwmblocks }
" Turns off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable.
if &diff
highlight! link DiffText MatchParen
endif
" Function for toggling the bottom statusbar:
let s:hidden_all = 0
function! ToggleHiddenAll()
if s:hidden_all == 0
let s:hidden_all = 1
set noshowmode
set noruler
set laststatus=0
set noshowcmd
else
let s:hidden_all = 0
set showmode
set ruler
set laststatus=2
set showcmd
endif
endfunction
nnoremap <leader>h :call ToggleHiddenAll()<CR>
" Load command shortcuts generated from bm-dirs and bm-files via shortcuts script.
" Here leader is ";".
" So ":vs ;cfz" will expand into ":vs /home/<user>/.config/zsh/.zshrc"
" if typed fast without the timeout.
silent! source ~/.config/nvim/shortcuts.vim

View file

@ -0,0 +1,62 @@
local M = {}
local fn = vim.fn
M.echo = function(str)
vim.cmd "redraw"
vim.api.nvim_echo({ { str, "Bold" } }, true, {})
end
local function shell_call(args)
local output = fn.system(args)
assert(vim.v.shell_error == 0, "External call failed with error code: " .. vim.v.shell_error .. "\n" .. output)
end
M.lazy = function(install_path)
------------- base46 ---------------
local lazy_path = fn.stdpath "data" .. "/lazy/base46"
M.echo " Compiling base46 theme to bytecode ..."
local base46_repo = "https://github.com/NvChad/base46"
shell_call { "git", "clone", "--depth", "1", "-b", "v2.0", base46_repo, lazy_path }
vim.opt.rtp:prepend(lazy_path)
require("base46").compile()
--------- lazy.nvim ---------------
M.echo " Installing lazy.nvim & plugins ..."
local repo = "https://github.com/folke/lazy.nvim.git"
shell_call { "git", "clone", "--filter=blob:none", "--branch=stable", repo, install_path }
vim.opt.rtp:prepend(install_path)
-- install plugins
require "plugins"
-- mason packages & show post_bootstrap screen
require "nvchad.post_install"()
end
M.gen_chadrc_template = function()
local path = fn.stdpath "config" .. "/lua/custom"
if fn.isdirectory(path) ~= 1 then
local input = vim.env.NVCHAD_EXAMPLE_CONFIG or fn.input "Do you want to install example custom config? (y/N): "
if input:lower() == "y" then
M.echo "Cloning example custom config repo..."
shell_call { "git", "clone", "--depth", "1", "https://github.com/NvChad/example_config", path }
fn.delete(path .. "/.git", "rf")
else
-- use very minimal chadrc
fn.mkdir(path, "p")
local file = io.open(path .. "/chadrc.lua", "w")
if file then
file:write "---@type ChadrcConfig\nlocal M = {}\n\nM.ui = { theme = 'onedark' }\n\nreturn M"
file:close()
end
end
end
end
return M

View file

@ -0,0 +1,92 @@
local M = {}
M.options = {
nvchad_branch = "v2.0",
}
M.ui = {
------------------------------- base46 -------------------------------------
-- hl = highlights
hl_add = {},
hl_override = {},
changed_themes = {},
theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme
transparency = false,
lsp_semantic_tokens = false, -- needs nvim v0.9, just adds highlight groups for lsp semantic tokens
-- https://github.com/NvChad/base46/tree/v2.0/lua/base46/extended_integrations
extended_integrations = {}, -- these aren't compiled by default, ex: "alpha", "notify"
-- cmp themeing
cmp = {
icons = true,
lspkind_text = true,
style = "default", -- default/flat_light/flat_dark/atom/atom_colored
border_color = "grey_fg", -- only applicable for "default" style, use color names from base30 variables
selected_item_bg = "colored", -- colored / simple
},
telescope = { style = "borderless" }, -- borderless / bordered
------------------------------- nvchad_ui modules -----------------------------
statusline = {
theme = "default", -- default/vscode/vscode_colored/minimal
-- default/round/block/arrow separators work only for default statusline theme
-- round and block will work for minimal theme only
separator_style = "default",
overriden_modules = nil,
},
-- lazyload it when there are 1+ buffers
tabufline = {
show_numbers = false,
enabled = true,
lazyload = true,
overriden_modules = nil,
},
-- nvdash (dashboard)
nvdash = {
load_on_startup = false,
header = {
" ▄ ▄ ",
" ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ ",
" █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ ",
" ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ ",
" ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ",
" █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄",
"▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █",
"█▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █",
" █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ ",
},
buttons = {
{ " Find File", "Spc f f", "Telescope find_files" },
{ "󰈚 Recent Files", "Spc f o", "Telescope oldfiles" },
{ "󰈭 Find Word", "Spc f w", "Telescope live_grep" },
{ " Bookmarks", "Spc m a", "Telescope marks" },
{ " Themes", "Spc t h", "Telescope themes" },
{ " Mappings", "Spc c h", "NvCheatsheet" },
},
},
cheatsheet = { theme = "grid" }, -- simple/grid
lsp = {
-- show function signatures i.e args as you type
signature = {
disabled = false,
silent = true, -- silences 'no signature help available' message from appearing
},
},
}
M.plugins = "" -- path i.e "custom.plugins", so make custom/plugins.lua file
M.lazy_nvim = require "plugins.configs.lazy_nvim" -- config for lazy.nvim startup options
M.mappings = require "core.mappings"
return M

View file

@ -0,0 +1,115 @@
local opt = vim.opt
local g = vim.g
local config = require("core.utils").load_config()
-------------------------------------- globals -----------------------------------------
g.nvchad_theme = config.ui.theme
g.base46_cache = vim.fn.stdpath "data" .. "/nvchad/base46/"
g.toggle_theme_icon = ""
g.transparency = config.ui.transparency
-------------------------------------- options ------------------------------------------
opt.laststatus = 3 -- global statusline
opt.showmode = false
opt.clipboard = "unnamedplus"
opt.cursorline = true
-- Indenting
opt.expandtab = true
opt.shiftwidth = 2
opt.smartindent = true
opt.tabstop = 2
opt.softtabstop = 2
opt.fillchars = { eob = " " }
opt.ignorecase = true
opt.smartcase = true
opt.mouse = "a"
-- Numbers
opt.number = true
opt.numberwidth = 2
opt.ruler = false
-- disable nvim intro
opt.shortmess:append "sI"
opt.signcolumn = "yes"
opt.splitbelow = true
opt.splitright = true
opt.termguicolors = true
opt.timeoutlen = 400
opt.undofile = true
-- interval for writing swap file to disk, also used by gitsigns
opt.updatetime = 250
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>[]hl"
g.mapleader = " "
-- disable some default providers
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
vim.g["loaded_" .. provider .. "_provider"] = 0
end
-- add binaries installed by mason.nvim to path
local is_windows = vim.loop.os_uname().sysname == "Windows_NT"
vim.env.PATH = vim.fn.stdpath "data" .. "/mason/bin" .. (is_windows and ";" or ":") .. vim.env.PATH
-------------------------------------- autocmds ------------------------------------------
local autocmd = vim.api.nvim_create_autocmd
-- dont list quickfix buffers
autocmd("FileType", {
pattern = "qf",
callback = function()
vim.opt_local.buflisted = false
end,
})
-- reload some chadrc options on-save
autocmd("BufWritePost", {
pattern = vim.tbl_map(function(path)
return vim.fs.normalize(vim.loop.fs_realpath(path))
end, vim.fn.glob(vim.fn.stdpath "config" .. "/lua/custom/**/*.lua", true, true, true)),
group = vim.api.nvim_create_augroup("ReloadNvChad", {}),
callback = function(opts)
local fp = vim.fn.fnamemodify(vim.fs.normalize(vim.api.nvim_buf_get_name(opts.buf)), ":r") --[[@as string]]
local app_name = vim.env.NVIM_APPNAME and vim.env.NVIM_APPNAME or "nvim"
local module = string.gsub(fp, "^.*/" .. app_name .. "/lua/", ""):gsub("/", ".")
require("plenary.reload").reload_module "base46"
require("plenary.reload").reload_module(module)
require("plenary.reload").reload_module "custom.chadrc"
config = require("core.utils").load_config()
vim.g.nvchad_theme = config.ui.theme
vim.g.transparency = config.ui.transparency
-- statusline
require("plenary.reload").reload_module("nvchad.statusline." .. config.ui.statusline.theme)
vim.opt.statusline = "%!v:lua.require('nvchad.statusline." .. config.ui.statusline.theme .. "').run()"
-- tabufline
if config.ui.tabufline.enabled then
require("plenary.reload").reload_module "nvchad.tabufline.modules"
vim.opt.tabline = "%!v:lua.require('nvchad.tabufline.modules').run()"
end
require("base46").load_all_highlights()
-- vim.cmd("redraw!")
end,
})
-------------------------------------- commands ------------------------------------------
local new_cmd = vim.api.nvim_create_user_command
new_cmd("NvChadUpdate", function()
require "nvchad.updater"()
end, {})

View file

@ -0,0 +1,468 @@
-- n, v, i, t = mode names
local M = {}
M.general = {
i = {
-- go to beginning and end
["<C-b>"] = { "<ESC>^i", "Beginning of line" },
["<C-e>"] = { "<End>", "End of line" },
-- navigate within insert mode
["<C-h>"] = { "<Left>", "Move left" },
["<C-l>"] = { "<Right>", "Move right" },
["<C-j>"] = { "<Down>", "Move down" },
["<C-k>"] = { "<Up>", "Move up" },
},
n = {
["<Esc>"] = { "<cmd> noh <CR>", "Clear highlights" },
-- switch between windows
["<C-h>"] = { "<C-w>h", "Window left" },
["<C-l>"] = { "<C-w>l", "Window right" },
["<C-j>"] = { "<C-w>j", "Window down" },
["<C-k>"] = { "<C-w>k", "Window up" },
-- save
["<C-s>"] = { "<cmd> w <CR>", "Save file" },
-- Copy all
["<C-c>"] = { "<cmd> %y+ <CR>", "Copy whole file" },
-- line numbers
["<leader>n"] = { "<cmd> set nu! <CR>", "Toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", "Toggle relative number" },
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
-- new buffer
["<leader>b"] = { "<cmd> enew <CR>", "New buffer" },
["<leader>ch"] = { "<cmd> NvCheatsheet <CR>", "Mapping cheatsheet" },
["<leader>fm"] = {
function()
vim.lsp.buf.format { async = true }
end,
"LSP formatting",
},
},
t = {
["<C-x>"] = { vim.api.nvim_replace_termcodes("<C-\\><C-N>", true, true, true), "Escape terminal mode" },
},
v = {
["<Up>"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
["<Down>"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
["<"] = { "<gv", "Indent line" },
[">"] = { ">gv", "Indent line" },
},
x = {
["j"] = { 'v:count || mode(1)[0:1] == "no" ? "j" : "gj"', "Move down", opts = { expr = true } },
["k"] = { 'v:count || mode(1)[0:1] == "no" ? "k" : "gk"', "Move up", opts = { expr = true } },
-- Don't copy the replaced text after pasting in visual mode
-- https://vim.fandom.com/wiki/Replace_a_word_with_yanked_text#Alternative_mapping_for_paste
["p"] = { 'p:let @+=@0<CR>:let @"=@0<CR>', "Dont copy replaced text", opts = { silent = true } },
},
}
M.tabufline = {
plugin = true,
n = {
-- cycle through buffers
["<tab>"] = {
function()
require("nvchad.tabufline").tabuflineNext()
end,
"Goto next buffer",
},
["<S-tab>"] = {
function()
require("nvchad.tabufline").tabuflinePrev()
end,
"Goto prev buffer",
},
-- close buffer + hide terminal buffer
["<leader>x"] = {
function()
require("nvchad.tabufline").close_buffer()
end,
"Close buffer",
},
},
}
M.comment = {
plugin = true,
-- toggle comment in both modes
n = {
["<leader>/"] = {
function()
require("Comment.api").toggle.linewise.current()
end,
"Toggle comment",
},
},
v = {
["<leader>/"] = {
"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
"Toggle comment",
},
},
}
M.lspconfig = {
plugin = true,
-- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions
n = {
["gD"] = {
function()
vim.lsp.buf.declaration()
end,
"LSP declaration",
},
["gd"] = {
function()
vim.lsp.buf.definition()
end,
"LSP definition",
},
["K"] = {
function()
vim.lsp.buf.hover()
end,
"LSP hover",
},
["gi"] = {
function()
vim.lsp.buf.implementation()
end,
"LSP implementation",
},
["<leader>ls"] = {
function()
vim.lsp.buf.signature_help()
end,
"LSP signature help",
},
["<leader>D"] = {
function()
vim.lsp.buf.type_definition()
end,
"LSP definition type",
},
["<leader>ra"] = {
function()
require("nvchad.renamer").open()
end,
"LSP rename",
},
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"LSP code action",
},
["gr"] = {
function()
vim.lsp.buf.references()
end,
"LSP references",
},
["<leader>lf"] = {
function()
vim.diagnostic.open_float { border = "rounded" }
end,
"Floating diagnostic",
},
["[d"] = {
function()
vim.diagnostic.goto_prev { float = { border = "rounded" } }
end,
"Goto prev",
},
["]d"] = {
function()
vim.diagnostic.goto_next { float = { border = "rounded" } }
end,
"Goto next",
},
["<leader>q"] = {
function()
vim.diagnostic.setloclist()
end,
"Diagnostic setloclist",
},
["<leader>wa"] = {
function()
vim.lsp.buf.add_workspace_folder()
end,
"Add workspace folder",
},
["<leader>wr"] = {
function()
vim.lsp.buf.remove_workspace_folder()
end,
"Remove workspace folder",
},
["<leader>wl"] = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"List workspace folders",
},
},
v = {
["<leader>ca"] = {
function()
vim.lsp.buf.code_action()
end,
"LSP code action",
},
},
}
M.nvimtree = {
plugin = true,
n = {
-- toggle
["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", "Toggle nvimtree" },
-- focus
["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", "Focus nvimtree" },
},
}
M.telescope = {
plugin = true,
n = {
-- find
["<leader>ff"] = { "<cmd> Telescope find_files <CR>", "Find files" },
["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", "Find all" },
["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", "Live grep" },
["<leader>fb"] = { "<cmd> Telescope buffers <CR>", "Find buffers" },
["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", "Help page" },
["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", "Find oldfiles" },
["<leader>fz"] = { "<cmd> Telescope current_buffer_fuzzy_find <CR>", "Find in current buffer" },
-- git
["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", "Git commits" },
["<leader>gt"] = { "<cmd> Telescope git_status <CR>", "Git status" },
-- pick a hidden term
["<leader>pt"] = { "<cmd> Telescope terms <CR>", "Pick hidden term" },
-- theme switcher
["<leader>th"] = { "<cmd> Telescope themes <CR>", "Nvchad themes" },
["<leader>ma"] = { "<cmd> Telescope marks <CR>", "telescope bookmarks" },
},
}
M.nvterm = {
plugin = true,
t = {
-- toggle in terminal mode
["<A-i>"] = {
function()
require("nvterm.terminal").toggle "float"
end,
"Toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"Toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"Toggle vertical term",
},
},
n = {
-- toggle in normal mode
["<A-i>"] = {
function()
require("nvterm.terminal").toggle "float"
end,
"Toggle floating term",
},
["<A-h>"] = {
function()
require("nvterm.terminal").toggle "horizontal"
end,
"Toggle horizontal term",
},
["<A-v>"] = {
function()
require("nvterm.terminal").toggle "vertical"
end,
"Toggle vertical term",
},
-- new
["<leader>h"] = {
function()
require("nvterm.terminal").new "horizontal"
end,
"New horizontal term",
},
["<leader>v"] = {
function()
require("nvterm.terminal").new "vertical"
end,
"New vertical term",
},
},
}
M.whichkey = {
plugin = true,
n = {
["<leader>wK"] = {
function()
vim.cmd "WhichKey"
end,
"Which-key all keymaps",
},
["<leader>wk"] = {
function()
local input = vim.fn.input "WhichKey: "
vim.cmd("WhichKey " .. input)
end,
"Which-key query lookup",
},
},
}
M.blankline = {
plugin = true,
n = {
["<leader>cc"] = {
function()
local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope
)
if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]]
end
end,
"Jump to current context",
},
},
}
M.gitsigns = {
plugin = true,
n = {
-- Navigation through hunks
["]c"] = {
function()
if vim.wo.diff then
return "]c"
end
vim.schedule(function()
require("gitsigns").next_hunk()
end)
return "<Ignore>"
end,
"Jump to next hunk",
opts = { expr = true },
},
["[c"] = {
function()
if vim.wo.diff then
return "[c"
end
vim.schedule(function()
require("gitsigns").prev_hunk()
end)
return "<Ignore>"
end,
"Jump to prev hunk",
opts = { expr = true },
},
-- Actions
["<leader>rh"] = {
function()
require("gitsigns").reset_hunk()
end,
"Reset hunk",
},
["<leader>ph"] = {
function()
require("gitsigns").preview_hunk()
end,
"Preview hunk",
},
["<leader>gb"] = {
function()
package.loaded.gitsigns.blame_line()
end,
"Blame line",
},
["<leader>td"] = {
function()
require("gitsigns").toggle_deleted()
end,
"Toggle deleted",
},
},
}
return M

View file

@ -0,0 +1,118 @@
local M = {}
local merge_tb = vim.tbl_deep_extend
M.load_config = function()
local config = require "core.default_config"
local chadrc_path = vim.api.nvim_get_runtime_file("lua/custom/chadrc.lua", false)[1]
if chadrc_path then
local chadrc = dofile(chadrc_path)
config.mappings = M.remove_disabled_keys(chadrc.mappings, config.mappings)
config = merge_tb("force", config, chadrc)
config.mappings.disabled = nil
end
return config
end
M.remove_disabled_keys = function(chadrc_mappings, default_mappings)
if not chadrc_mappings then
return default_mappings
end
-- store keys in a array with true value to compare
local keys_to_disable = {}
for _, mappings in pairs(chadrc_mappings) do
for mode, section_keys in pairs(mappings) do
if not keys_to_disable[mode] then
keys_to_disable[mode] = {}
end
section_keys = (type(section_keys) == "table" and section_keys) or {}
for k, _ in pairs(section_keys) do
keys_to_disable[mode][k] = true
end
end
end
-- make a copy as we need to modify default_mappings
for section_name, section_mappings in pairs(default_mappings) do
for mode, mode_mappings in pairs(section_mappings) do
mode_mappings = (type(mode_mappings) == "table" and mode_mappings) or {}
for k, _ in pairs(mode_mappings) do
-- if key if found then remove from default_mappings
if keys_to_disable[mode] and keys_to_disable[mode][k] then
default_mappings[section_name][mode][k] = nil
end
end
end
end
return default_mappings
end
M.load_mappings = function(section, mapping_opt)
vim.schedule(function()
local function set_section_map(section_values)
if section_values.plugin then
return
end
section_values.plugin = nil
for mode, mode_values in pairs(section_values) do
local default_opts = merge_tb("force", { mode = mode }, mapping_opt or {})
for keybind, mapping_info in pairs(mode_values) do
-- merge default + user opts
local opts = merge_tb("force", default_opts, mapping_info.opts or {})
mapping_info.opts, opts.mode = nil, nil
opts.desc = mapping_info[2]
vim.keymap.set(mode, keybind, mapping_info[1], opts)
end
end
end
local mappings = require("core.utils").load_config().mappings
if type(section) == "string" then
mappings[section]["plugin"] = nil
mappings = { mappings[section] }
end
for _, sect in pairs(mappings) do
set_section_map(sect)
end
end)
end
M.lazy_load = function(plugin)
vim.api.nvim_create_autocmd({ "BufRead", "BufWinEnter", "BufNewFile" }, {
group = vim.api.nvim_create_augroup("BeLazyOnFileOpen" .. plugin, {}),
callback = function()
local file = vim.fn.expand "%"
local condition = file ~= "NvimTree_1" and file ~= "[lazy]" and file ~= ""
if condition then
vim.api.nvim_del_augroup_by_name("BeLazyOnFileOpen" .. plugin)
-- dont defer for treesitter as it will show slow highlighting
-- This deferring only happens only when we do "nvim filename"
if plugin ~= "nvim-treesitter" then
vim.schedule(function()
require("lazy").load { plugins = plugin }
if plugin == "nvim-lspconfig" then
vim.cmd "silent! do FileType"
end
end, 0)
else
require("lazy").load { plugins = plugin }
end
end
end,
})
end
return M

View file

@ -0,0 +1,120 @@
local cmp = require "cmp"
dofile(vim.g.base46_cache .. "cmp")
local cmp_ui = require("core.utils").load_config().ui.cmp
local cmp_style = cmp_ui.style
local field_arrangement = {
atom = { "kind", "abbr", "menu" },
atom_colored = { "kind", "abbr", "menu" },
}
local formatting_style = {
-- default fields order i.e completion word + item.kind + item.kind icons
fields = field_arrangement[cmp_style] or { "abbr", "kind", "menu" },
format = function(_, item)
local icons = require "nvchad.icons.lspkind"
local icon = (cmp_ui.icons and icons[item.kind]) or ""
if cmp_style == "atom" or cmp_style == "atom_colored" then
icon = " " .. icon .. " "
item.menu = cmp_ui.lspkind_text and " (" .. item.kind .. ")" or ""
item.kind = icon
else
icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon
item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "")
end
return item
end,
}
local function border(hl_name)
return {
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
{ "", hl_name },
}
end
local options = {
completion = {
completeopt = "menu,menuone",
},
window = {
completion = {
side_padding = (cmp_style ~= "atom" and cmp_style ~= "atom_colored") and 1 or 0,
winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,Search:None",
scrollbar = false,
},
documentation = {
border = border "CmpDocBorder",
winhighlight = "Normal:CmpDoc",
},
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = formatting_style,
mapping = {
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Insert,
select = true,
},
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif require("luasnip").expand_or_jumpable() then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif require("luasnip").jumpable(-1) then
vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "")
else
fallback()
end
end, {
"i",
"s",
}),
},
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "path" },
},
}
if cmp_style ~= "atom" and cmp_style ~= "atom_colored" then
options.window.completion.border = border "CmpBorder"
end
return options

View file

@ -0,0 +1,47 @@
return {
defaults = { lazy = true },
install = { colorscheme = { "nvchad" } },
ui = {
icons = {
ft = "",
lazy = "󰂠 ",
loaded = "",
not_loaded = "",
},
},
performance = {
rtp = {
disabled_plugins = {
"2html_plugin",
"tohtml",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"netrw",
"netrwPlugin",
"netrwSettings",
"netrwFileHandlers",
"matchit",
"tar",
"tarPlugin",
"rrhelper",
"spellfile_plugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"tutor",
"rplugin",
"syntax",
"synmenu",
"optwin",
"compiler",
"bugreport",
"ftplugin",
},
},
},
}

View file

@ -0,0 +1,64 @@
dofile(vim.g.base46_cache .. "lsp")
require "nvchad.lsp"
local M = {}
local utils = require "core.utils"
-- export on_attach & capabilities for custom lspconfigs
M.on_attach = function(client, bufnr)
utils.load_mappings("lspconfig", { buffer = bufnr })
if client.server_capabilities.signatureHelpProvider then
require("nvchad.signature").setup(client)
end
if not utils.load_config().ui.lsp_semantic_tokens and client.supports_method "textDocument/semanticTokens" then
client.server_capabilities.semanticTokensProvider = nil
end
end
M.capabilities = vim.lsp.protocol.make_client_capabilities()
M.capabilities.textDocument.completion.completionItem = {
documentationFormat = { "markdown", "plaintext" },
snippetSupport = true,
preselectSupport = true,
insertReplaceSupport = true,
labelDetailsSupport = true,
deprecatedSupport = true,
commitCharactersSupport = true,
tagSupport = { valueSet = { 1 } },
resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
},
}
require("lspconfig").lua_ls.setup {
on_attach = M.on_attach,
capabilities = M.capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand "$VIMRUNTIME/lua"] = true,
[vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true,
[vim.fn.stdpath "data" .. "/lazy/ui/nvchad_types"] = true,
[vim.fn.stdpath "data" .. "/lazy/lazy.nvim/lua/lazy"] = true,
},
maxPreload = 100000,
preloadFileSize = 10000,
},
},
},
}
return M

View file

@ -0,0 +1,28 @@
local options = {
ensure_installed = { "lua-language-server" }, -- not an option from mason.nvim
PATH = "skip",
ui = {
icons = {
package_pending = "",
package_installed = "󰄳 ",
package_uninstalled = " 󰚌",
},
keymaps = {
toggle_server_expand = "<CR>",
install_server = "i",
update_server = "u",
check_server_version = "c",
update_all_servers = "U",
check_outdated_servers = "C",
uninstall_server = "X",
cancel_installation = "<C-c>",
},
},
max_concurrent_installers = 10,
}
return options

View file

@ -0,0 +1,77 @@
local options = {
filters = {
dotfiles = false,
exclude = { vim.fn.stdpath "config" .. "/lua/custom" },
},
disable_netrw = true,
hijack_netrw = true,
hijack_cursor = true,
hijack_unnamed_buffer_when_opening = false,
sync_root_with_cwd = true,
update_focused_file = {
enable = true,
update_root = false,
},
view = {
adaptive_size = false,
side = "left",
width = 30,
preserve_window_proportions = true,
},
git = {
enable = false,
ignore = true,
},
filesystem_watchers = {
enable = true,
},
actions = {
open_file = {
resize_window = true,
},
},
renderer = {
root_folder_label = false,
highlight_git = false,
highlight_opened_files = "none",
indent_markers = {
enable = false,
},
icons = {
show = {
file = true,
folder = true,
folder_arrow = true,
git = false,
},
glyphs = {
default = "󰈚",
symlink = "",
folder = {
default = "",
empty = "",
empty_open = "",
open = "",
symlink = "",
symlink_open = "",
arrow_open = "",
arrow_closed = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
},
}
return options

View file

@ -0,0 +1,66 @@
local M = {}
local utils = require "core.utils"
M.blankline = {
indentLine_enabled = 1,
filetype_exclude = {
"help",
"terminal",
"lazy",
"lspinfo",
"TelescopePrompt",
"TelescopeResults",
"mason",
"nvdash",
"nvcheatsheet",
"",
},
buftype_exclude = { "terminal" },
show_trailing_blankline_indent = false,
show_first_indent_level = false,
show_current_context = true,
show_current_context_start = true,
}
M.luasnip = function(opts)
require("luasnip").config.set_config(opts)
-- vscode format
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_vscode").lazy_load { paths = vim.g.vscode_snippets_path or "" }
-- snipmate format
require("luasnip.loaders.from_snipmate").load()
require("luasnip.loaders.from_snipmate").lazy_load { paths = vim.g.snipmate_snippets_path or "" }
-- lua format
require("luasnip.loaders.from_lua").load()
require("luasnip.loaders.from_lua").lazy_load { paths = vim.g.lua_snippets_path or "" }
vim.api.nvim_create_autocmd("InsertLeave", {
callback = function()
if
require("luasnip").session.current_nodes[vim.api.nvim_get_current_buf()]
and not require("luasnip").session.jump_active
then
require("luasnip").unlink_current()
end
end,
})
end
M.gitsigns = {
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "󰍵" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
on_attach = function(bufnr)
utils.load_mappings("gitsigns", { buffer = bufnr })
end,
}
return M

View file

@ -0,0 +1,55 @@
local options = {
defaults = {
vimgrep_arguments = {
"rg",
"-L",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
file_sorter = require("telescope.sorters").get_fuzzy_file,
file_ignore_patterns = { "node_modules" },
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = { "", "", "", "", "", "", "", "" },
color_devicons = true,
set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-- Developer configurations: Not meant for general override
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
n = { ["q"] = require("telescope.actions").close },
},
},
extensions_list = { "themes", "terms" },
}
return options

View file

@ -0,0 +1,12 @@
local options = {
ensure_installed = { "lua" },
highlight = {
enable = true,
use_languagetree = true,
},
indent = { enable = true },
}
return options

View file

@ -0,0 +1,281 @@
-- All plugins have lazy=true by default,to load a plugin on startup just lazy=false
-- List of all default plugins & their definitions
local default_plugins = {
"nvim-lua/plenary.nvim",
{
"NvChad/base46",
branch = "v2.0",
build = function()
require("base46").load_all_highlights()
end,
},
{
"NvChad/ui",
branch = "v2.0",
lazy = false,
},
{
"NvChad/nvterm",
init = function()
require("core.utils").load_mappings "nvterm"
end,
config = function(_, opts)
require "base46.term"
require("nvterm").setup(opts)
end,
},
{
"NvChad/nvim-colorizer.lua",
init = function()
require("core.utils").lazy_load "nvim-colorizer.lua"
end,
config = function(_, opts)
require("colorizer").setup(opts)
-- execute colorizer as soon as possible
vim.defer_fn(function()
require("colorizer").attach_to_buffer(0)
end, 0)
end,
},
{
"nvim-tree/nvim-web-devicons",
opts = function()
return { override = require "nvchad.icons.devicons" }
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "devicons")
require("nvim-web-devicons").setup(opts)
end,
},
{
"lukas-reineke/indent-blankline.nvim",
version = "2.20.7",
init = function()
require("core.utils").lazy_load "indent-blankline.nvim"
end,
opts = function()
return require("plugins.configs.others").blankline
end,
config = function(_, opts)
require("core.utils").load_mappings "blankline"
dofile(vim.g.base46_cache .. "blankline")
require("indent_blankline").setup(opts)
end,
},
{
"nvim-treesitter/nvim-treesitter",
tag = "v0.9.2",
init = function()
require("core.utils").lazy_load "nvim-treesitter"
end,
cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" },
build = ":TSUpdate",
opts = function()
return require "plugins.configs.treesitter"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "syntax")
require("nvim-treesitter.configs").setup(opts)
end,
},
-- git stuff
{
"lewis6991/gitsigns.nvim",
ft = { "gitcommit", "diff" },
init = function()
-- load gitsigns only when a git file is opened
vim.api.nvim_create_autocmd({ "BufRead" }, {
group = vim.api.nvim_create_augroup("GitSignsLazyLoad", { clear = true }),
callback = function()
vim.fn.jobstart({"git", "-C", vim.loop.cwd(), "rev-parse"},
{
on_exit = function(_, return_code)
if return_code == 0 then
vim.api.nvim_del_augroup_by_name "GitSignsLazyLoad"
vim.schedule(function()
require("lazy").load { plugins = { "gitsigns.nvim" } }
end)
end
end
}
)
end,
})
end,
opts = function()
return require("plugins.configs.others").gitsigns
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "git")
require("gitsigns").setup(opts)
end,
},
-- lsp stuff
{
"williamboman/mason.nvim",
cmd = { "Mason", "MasonInstall", "MasonInstallAll", "MasonUpdate" },
opts = function()
return require "plugins.configs.mason"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "mason")
require("mason").setup(opts)
-- custom nvchad cmd to install all mason binaries listed
vim.api.nvim_create_user_command("MasonInstallAll", function()
if opts.ensure_installed and #opts.ensure_installed > 0 then
vim.cmd("MasonInstall " .. table.concat(opts.ensure_installed, " "))
end
end, {})
vim.g.mason_binaries_list = opts.ensure_installed
end,
},
{
"neovim/nvim-lspconfig",
init = function()
require("core.utils").lazy_load "nvim-lspconfig"
end,
config = function()
require "plugins.configs.lspconfig"
end,
},
-- load luasnips + cmp related in insert mode only
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
-- snippet plugin
"L3MON4D3/LuaSnip",
dependencies = "rafamadriz/friendly-snippets",
opts = { history = true, updateevents = "TextChanged,TextChangedI" },
config = function(_, opts)
require("plugins.configs.others").luasnip(opts)
end,
},
-- autopairing of (){}[] etc
{
"windwp/nvim-autopairs",
opts = {
fast_wrap = {},
disable_filetype = { "TelescopePrompt", "vim" },
},
config = function(_, opts)
require("nvim-autopairs").setup(opts)
-- setup cmp for autopairs
local cmp_autopairs = require "nvim-autopairs.completion.cmp"
require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done())
end,
},
-- cmp sources plugins
{
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
},
},
opts = function()
return require "plugins.configs.cmp"
end,
config = function(_, opts)
require("cmp").setup(opts)
end,
},
{
"numToStr/Comment.nvim",
keys = {
{ "gcc", mode = "n", desc = "Comment toggle current line" },
{ "gc", mode = { "n", "o" }, desc = "Comment toggle linewise" },
{ "gc", mode = "x", desc = "Comment toggle linewise (visual)" },
{ "gbc", mode = "n", desc = "Comment toggle current block" },
{ "gb", mode = { "n", "o" }, desc = "Comment toggle blockwise" },
{ "gb", mode = "x", desc = "Comment toggle blockwise (visual)" },
},
init = function()
require("core.utils").load_mappings "comment"
end,
config = function(_, opts)
require("Comment").setup(opts)
end,
},
-- file managing , picker etc
{
"nvim-tree/nvim-tree.lua",
cmd = { "NvimTreeToggle", "NvimTreeFocus" },
init = function()
require("core.utils").load_mappings "nvimtree"
end,
opts = function()
return require "plugins.configs.nvimtree"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "nvimtree")
require("nvim-tree").setup(opts)
end,
},
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = "Telescope",
init = function()
require("core.utils").load_mappings "telescope"
end,
opts = function()
return require "plugins.configs.telescope"
end,
config = function(_, opts)
dofile(vim.g.base46_cache .. "telescope")
local telescope = require "telescope"
telescope.setup(opts)
-- load extensions
for _, ext in ipairs(opts.extensions_list) do
telescope.load_extension(ext)
end
end,
},
-- Only load whichkey after all the gui
{
"folke/which-key.nvim",
keys = { "<leader>", "<c-r>", "<c-w>", '"', "'", "`", "c", "v", "g" },
init = function()
require("core.utils").load_mappings "whichkey"
end,
cmd = "WhichKey",
config = function(_, opts)
dofile(vim.g.base46_cache .. "whichkey")
require("which-key").setup(opts)
end,
},
}
local config = require("core.utils").load_config()
if #config.plugins > 0 then
table.insert(default_plugins, { import = config.plugins })
end
require("lazy").setup(default_plugins, config.lazy_nvim)

@ -0,0 +1 @@
Subproject commit 0236521ea582747b58869cb72f70ccfa967d2e89

@ -0,0 +1 @@
Subproject commit 2dbef19461198630b3d7c39f414d09fb07d1fdd2

@ -0,0 +1 @@
Subproject commit 3f2b658cbd6650ddaf2bae3233e143a41ca25b1a

@ -0,0 +1 @@
Subproject commit 3022dbc9166796b644a841a02de8dd1cc1d311fa

@ -0,0 +1 @@
Subproject commit 5af77f54de1b16c34b23cba810150689a3a90312

@ -0,0 +1 @@
Subproject commit f12408bdb54c39c23e67cab726264c10db33ada8

@ -0,0 +1 @@
Subproject commit 91ff86cd9c29299a64f968ebb45846c485725f23

@ -0,0 +1 @@
Subproject commit 05a9ab28b53f71d1aece421ef32fee2cb857a843

@ -0,0 +1 @@
Subproject commit aced40b66b7bae9bc2c37fd7b11841d54727a7b0

@ -0,0 +1 @@
Subproject commit fb9fd5312476b51a42a98122616e1c448d823d5c

@ -0,0 +1 @@
Subproject commit b7aa0aed55887edfaece23f7b46ab22232fc8741

@ -0,0 +1 @@
Subproject commit 28126922c9b54e35a192ac415788f202c3944c9f

@ -0,0 +1 @@
Subproject commit dcd0ea30ccfc7d47e879878d1270d6847a519181

@ -0,0 +1 @@
Subproject commit 096d0baecc34f6c5d8a6dd25851e9d5ad338209b

@ -0,0 +1 @@
Subproject commit 538e37ba87284942c1d76ed38dd497e54e65b891

@ -0,0 +1 @@
Subproject commit 85855b38011114929f4058efc97af1059ab3e41d

@ -0,0 +1 @@
Subproject commit 8917d2c830e04bf944a699b8c41f097621283828

@ -0,0 +1 @@
Subproject commit 7bdb220d0fe604a77361e92cdbc7af1b8a412126

@ -0,0 +1 @@
Subproject commit f197a15b0d1e8d555263af20add51450e5aaa1f0

@ -0,0 +1 @@
Subproject commit b427ac5f9dff494f839e81441fb3f04a58cbcfbc

@ -0,0 +1 @@
Subproject commit 3e43be1d0ca60cc5e2dfc2d289b06577e7e57e98

@ -0,0 +1 @@
Subproject commit 663246936325062427597964d81d30eaa42ab1e4

@ -0,0 +1 @@
Subproject commit 2f3857c25bbd00ed7ac593c9d4071906369e4d20

@ -0,0 +1 @@
Subproject commit 1737a2a98e18b635480756e817564b60ff31fc53

@ -0,0 +1 @@
Subproject commit 4433e5ec9a507e5097571ed55c02ea9658fb268a

View file

@ -0,0 +1 @@
/home/effe/.local/share/nvim/mason/packages/lua-language-server/lua-language-server

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 最萌小汐
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,85 @@
local main, exec
local i = 1
while arg[i] do
if arg[i] == '-E' then
elseif arg[i] == '-e' then
i = i + 1
local expr = assert(arg[i], "'-e' needs argument")
assert(load(expr, "=(command line)"))()
-- exit after the executing
exec = true
elseif not main and arg[i]:sub(1, 1) ~= '-' then
main = i
elseif arg[i]:sub(1, 2) == '--' then
break
end
i = i + 1
end
if exec and not main then
return
end
if main then
for i = -1, -999, -1 do
if not arg[i] then
for j = i + 1, -1 do
arg[j - main + 1] = arg[j]
end
break
end
end
for j = 1, #arg do
arg[j - main] = arg[j]
end
for j = #arg - main + 1, #arg do
arg[j] = nil
end
end
local root
do
if main then
local fs = require 'bee.filesystem'
local mainPath = fs.path(arg[0])
root = mainPath:parent_path():string()
if root == '' then
root = '.'
end
else
local sep = package.config:sub(1, 1)
if sep == '\\' then
sep = '/\\'
end
local pattern = "[" .. sep .. "]+[^" .. sep .. "]+"
root = package.cpath:match("([^;]+)" .. pattern .. pattern .. "$")
arg[0] = root .. package.config:sub(1, 1) .. 'main.lua'
end
root = root:gsub('[/\\]', package.config:sub(1, 1))
end
package.path = table.concat({
root .. "/script/?.lua",
root .. "/script/?/init.lua",
}, ";"):gsub('/', package.config:sub(1, 1))
package.searchers[2] = function (name)
local filename, err = package.searchpath(name, package.path)
if not filename then
return err
end
local f = io.open(filename)
if not f then
return 'cannot open file:' .. filename
end
local buf = f:read '*a'
f:close()
local relative = filename:sub(1, #root) == root and filename:sub(#root + 2) or filename
local init, err = load(buf, '@' .. relative)
if not init then
return err
end
return init, filename
end
assert(loadfile(arg[0]))(table.unpack(arg))

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
if not DEVELOP then
return
end
local fs = require 'bee.filesystem'
local luaDebugs = {}
local home = os.getenv 'USERPROFILE' or os.getenv 'HOME'
if not home then
log.error('Cannot find home directory')
return
end
for _, vscodePath in ipairs { '.vscode', '.vscode-insiders', '.vscode-server-insiders' } do
local extensionPath = fs.path(home) / vscodePath / 'extensions'
log.debug('Search extensions at:', extensionPath:string())
if fs.exists(extensionPath) then
for path in fs.pairs(extensionPath) do
if fs.is_directory(path) then
local name = path:filename():string()
if name:find('actboy168.lua-debug-', 1, true) then
luaDebugs[#luaDebugs+1] = path:string()
end
end
end
end
end
if #luaDebugs == 0 then
log.debug('Cant find "actboy168.lua-debug"')
return
end
local function getVer(filename)
local a, b, c = filename:match('actboy168%.lua%-debug%-(%d+)%.(%d+)%.(%d+)')
if not a then
return 0
end
return a * 1000000 + b * 1000 + c
end
table.sort(luaDebugs, function (a, b)
return getVer(a) > getVer(b)
end)
local debugPath = luaDebugs[1]
local cpath = "/runtime/win64/lua54/?.dll;/runtime/win64/lua54/?.so"
local path = "/script/?.lua"
local function tryDebugger()
local entry = assert(package.searchpath('debugger', debugPath .. path))
local root = debugPath
local addr = ("127.0.0.1:%d"):format(DBGPORT)
local dbg = loadfile(entry)(entry)
dbg:start {
address = addr,
}
log.debug('Debugger startup, listen port:', DBGPORT)
log.debug('Debugger args:', addr, root, path, cpath)
if DBGWAIT then
dbg:event('wait')
end
return dbg
end
xpcall(tryDebugger, log.debug)

View file

@ -0,0 +1,764 @@
---@diagnostic disable: undefined-global, lowercase-global
arg =
'Command-line arguments of Lua Standalone.'
assert =
'Raises an error if the value of its argument v is false (i.e., `nil` or `false`); otherwise, returns all its arguments. In case of error, `message` is the error object; when absent, it defaults to `"assertion failed!"`'
cgopt.collect =
'Performs a full garbage-collection cycle.'
cgopt.stop =
'Stops automatic execution.'
cgopt.restart =
'Restarts automatic execution.'
cgopt.count =
'Returns the total memory in Kbytes.'
cgopt.step =
'Performs a garbage-collection step.'
cgopt.setpause =
'Set `pause`.'
cgopt.setstepmul =
'Set `step multiplier`.'
cgopt.incremental =
'Change the collector mode to incremental.'
cgopt.generational =
'Change the collector mode to generational.'
cgopt.isrunning =
'Returns whether the collector is running.'
collectgarbage =
'This function is a generic interface to the garbage collector. It performs different functions according to its first argument, `opt`.'
dofile =
'Opens the named file and executes its content as a Lua chunk. When called without arguments, `dofile` executes the content of the standard input (`stdin`). Returns all values returned by the chunk. In case of errors, `dofile` propagates the error to its caller. (That is, `dofile` does not run in protected mode.)'
error =
[[
Terminates the last protected function called and returns message as the error object.
Usually, `error` adds some information about the error position at the beginning of the message, if the message is a string.
]]
_G =
'A global variable (not a function) that holds the global environment (see §2.2). Lua itself does not use this variable; changing its value does not affect any environment, nor vice versa.'
getfenv =
'Returns the current environment in use by the function. `f` can be a Lua function or a number that specifies the function at that stack level.'
getmetatable =
'If object does not have a metatable, returns nil. Otherwise, if the object\'s metatable has a __metatable field, returns the associated value. Otherwise, returns the metatable of the given object.'
ipairs =
[[
Returns three values (an iterator function, the table `t`, and `0`) so that the construction
```lua
for i,v in ipairs(t) do body end
```
will iterate over the keyvalue pairs `(1,t[1]), (2,t[2]), ...`, up to the first absent index.
]]
loadmode.b =
'Only binary chunks.'
loadmode.t =
'Only text chunks.'
loadmode.bt =
'Both binary and text.'
load['<5.1'] =
'Loads a chunk using function `func` to get its pieces. Each call to `func` must return a string that concatenates with previous results.'
load['>5.2'] =
[[
Loads a chunk.
If `chunk` is a string, the chunk is this string. If `chunk` is a function, `load` calls it repeatedly to get the chunk pieces. Each call to `chunk` must return a string that concatenates with previous results. A return of an empty string, `nil`, or no value signals the end of the chunk.
]]
loadfile =
'Loads a chunk from file `filename` or from the standard input, if no file name is given.'
loadstring =
'Loads a chunk from the given string.'
module =
'Creates a module.'
next =
[[
Allows a program to traverse all fields of a table. Its first argument is a table and its second argument is an index in this table. A call to `next` returns the next index of the table and its associated value. When called with `nil` as its second argument, `next` returns an initial index and its associated value. When called with the last index, or with `nil` in an empty table, `next` returns `nil`. If the second argument is absent, then it is interpreted as `nil`. In particular, you can use `next(t)` to check whether a table is empty.
The order in which the indices are enumerated is not specified, *even for numeric indices*. (To traverse a table in numerical order, use a numerical `for`.)
The behavior of `next` is undefined if, during the traversal, you assign any value to a non-existent field in the table. You may however modify existing fields. In particular, you may set existing fields to nil.
]]
pairs =
[[
If `t` has a metamethod `__pairs`, calls it with t as argument and returns the first three results from the call.
Otherwise, returns three values: the $next function, the table `t`, and `nil`, so that the construction
```lua
for k,v in pairs(t) do body end
```
will iterate over all keyvalue pairs of table `t`.
See function $next for the caveats of modifying the table during its traversal.
]]
pcall =
[[
Calls the function `f` with the given arguments in *protected mode*. This means that any error inside `f` is not propagated; instead, `pcall` catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, `pcall` also returns all results from the call, after this first result. In case of any error, `pcall` returns `false` plus the error object.
]]
print =
[[
Receives any number of arguments and prints their values to `stdout`, converting each argument to a string following the same rules of $tostring.
The function print is not intended for formatted output, but only as a quick way to show a value, for instance for debugging. For complete control over the output, use $string.format and $io.write.
]]
rawequal =
'Checks whether v1 is equal to v2, without invoking the `__eq` metamethod.'
rawget =
'Gets the real value of `table[index]`, without invoking the `__index` metamethod.'
rawlen =
'Returns the length of the object `v`, without invoking the `__len` metamethod.'
rawset =
[[
Sets the real value of `table[index]` to `value`, without using the `__newindex` metavalue. `table` must be a table, `index` any value different from `nil` and `NaN`, and `value` any Lua value.
This function returns `table`.
]]
select =
'If `index` is a number, returns all arguments after argument number `index`; a negative number indexes from the end (`-1` is the last argument). Otherwise, `index` must be the string `"#"`, and `select` returns the total number of extra arguments it received.'
setfenv =
'Sets the environment to be used by the given function.'
setmetatable =
[[
Sets the metatable for the given table. If `metatable` is `nil`, removes the metatable of the given table. If the original metatable has a `__metatable` field, raises an error.
This function returns `table`.
To change the metatable of other types from Lua code, you must use the debug library (§6.10).
]]
tonumber =
[[
When called with no `base`, `tonumber` tries to convert its argument to a number. If the argument is already a number or a string convertible to a number, then `tonumber` returns this number; otherwise, it returns `fail`.
The conversion of strings can result in integers or floats, according to the lexical conventions of Lua (see §3.1). The string may have leading and trailing spaces and a sign.
]]
tostring =
[[
Receives a value of any type and converts it to a string in a human-readable format.
If the metatable of `v` has a `__tostring` field, then `tostring` calls the corresponding value with `v` as argument, and uses the result of the call as its result. Otherwise, if the metatable of `v` has a `__name` field with a string value, `tostring` may use that string in its final result.
For complete control of how numbers are converted, use $string.format.
]]
type =
[[
Returns the type of its only argument, coded as a string. The possible results of this function are `"nil"` (a string, not the value `nil`), `"number"`, `"string"`, `"boolean"`, `"table"`, `"function"`, `"thread"`, and `"userdata"`.
]]
_VERSION =
'A global variable (not a function) that holds a string containing the running Lua version.'
warn =
'Emits a warning with a message composed by the concatenation of all its arguments (which should be strings).'
xpcall['=5.1'] =
'Calls function `f` with the given arguments in protected mode with a new message handler.'
xpcall['>5.2'] =
'Calls function `f` with the given arguments in protected mode with a new message handler.'
unpack =
[[
Returns the elements from the given `list`. This function is equivalent to
```lua
return list[i], list[i+1], ···, list[j]
```
]]
bit32 =
''
bit32.arshift =
[[
Returns the number `x` shifted `disp` bits to the right. Negative displacements shift to the left.
This shift operation is what is called arithmetic shift. Vacant bits on the left are filled with copies of the higher bit of `x`; vacant bits on the right are filled with zeros.
]]
bit32.band =
'Returns the bitwise *and* of its operands.'
bit32.bnot =
[[
Returns the bitwise negation of `x`.
```lua
assert(bit32.bnot(x) ==
(-1 - x) % 2^32)
```
]]
bit32.bor =
'Returns the bitwise *or* of its operands.'
bit32.btest =
'Returns a boolean signaling whether the bitwise *and* of its operands is different from zero.'
bit32.bxor =
'Returns the bitwise *exclusive or* of its operands.'
bit32.extract =
'Returns the unsigned number formed by the bits `field` to `field + width - 1` from `n`.'
bit32.replace =
'Returns a copy of `n` with the bits `field` to `field + width - 1` replaced by the value `v` .'
bit32.lrotate =
'Returns the number `x` rotated `disp` bits to the left. Negative displacements rotate to the right.'
bit32.lshift =
[[
Returns the number `x` shifted `disp` bits to the left. Negative displacements shift to the right. In any direction, vacant bits are filled with zeros.
```lua
assert(bit32.lshift(b, disp) ==
(b * 2^disp) % 2^32)
```
]]
bit32.rrotate =
'Returns the number `x` rotated `disp` bits to the right. Negative displacements rotate to the left.'
bit32.rshift =
[[
Returns the number `x` shifted `disp` bits to the right. Negative displacements shift to the left. In any direction, vacant bits are filled with zeros.
```lua
assert(bit32.rshift(b, disp) ==
math.floor(b % 2^32 / 2^disp))
```
]]
coroutine =
''
coroutine.create =
'Creates a new coroutine, with body `f`. `f` must be a function. Returns this new coroutine, an object with type `"thread"`.'
coroutine.isyieldable =
'Returns true when the running coroutine can yield.'
coroutine.isyieldable['>5.4']=
'Returns true when the coroutine `co` can yield. The default for `co` is the running coroutine.'
coroutine.close =
'Closes coroutine `co` , closing all its pending to-be-closed variables and putting the coroutine in a dead state.'
coroutine.resume =
'Starts or continues the execution of coroutine `co`.'
coroutine.running =
'Returns the running coroutine plus a boolean, true when the running coroutine is the main one.'
coroutine.status =
'Returns the status of coroutine `co`.'
coroutine.wrap =
'Creates a new coroutine, with body `f`; `f` must be a function. Returns a function that resumes the coroutine each time it is called.'
coroutine.yield =
'Suspends the execution of the calling coroutine.'
costatus.running =
'Is running.'
costatus.suspended =
'Is suspended or not started.'
costatus.normal =
'Is active but not running.'
costatus.dead =
'Has finished or stopped with an error.'
debug =
''
debug.debug =
'Enters an interactive mode with the user, running each string that the user enters.'
debug.getfenv =
'Returns the environment of object `o` .'
debug.gethook =
'Returns the current hook settings of the thread.'
debug.getinfo =
'Returns a table with information about a function.'
debug.getlocal['<5.1'] =
'Returns the name and the value of the local variable with index `local` of the function at level `level` of the stack.'
debug.getlocal['>5.2'] =
'Returns the name and the value of the local variable with index `local` of the function at level `f` of the stack.'
debug.getmetatable =
'Returns the metatable of the given value.'
debug.getregistry =
'Returns the registry table.'
debug.getupvalue =
'Returns the name and the value of the upvalue with index `up` of the function.'
debug.getuservalue['<5.3'] =
'Returns the Lua value associated to u.'
debug.getuservalue['>5.4'] =
[[
Returns the `n`-th user value associated
to the userdata `u` plus a boolean,
`false` if the userdata does not have that value.
]]
debug.setcstacklimit =
[[
### **Deprecated in `Lua 5.4.2`**
Sets a new limit for the C stack. This limit controls how deeply nested calls can go in Lua, with the intent of avoiding a stack overflow.
In case of success, this function returns the old limit. In case of error, it returns `false`.
]]
debug.setfenv =
'Sets the environment of the given `object` to the given `table` .'
debug.sethook =
'Sets the given function as a hook.'
debug.setlocal =
'Assigns the `value` to the local variable with index `local` of the function at `level` of the stack.'
debug.setmetatable =
'Sets the metatable for the given value to the given table (which can be `nil`).'
debug.setupvalue =
'Assigns the `value` to the upvalue with index `up` of the function.'
debug.setuservalue['<5.3'] =
'Sets the given value as the Lua value associated to the given udata.'
debug.setuservalue['>5.4'] =
[[
Sets the given `value` as
the `n`-th user value associated to the given `udata`.
`udata` must be a full userdata.
]]
debug.traceback =
'Returns a string with a traceback of the call stack. The optional message string is appended at the beginning of the traceback.'
debug.upvalueid =
'Returns a unique identifier (as a light userdata) for the upvalue numbered `n` from the given function.'
debug.upvaluejoin =
'Make the `n1`-th upvalue of the Lua closure `f1` refer to the `n2`-th upvalue of the Lua closure `f2`.'
infowhat.n =
'`name` and `namewhat`'
infowhat.S =
'`source`, `short_src`, `linedefined`, `lastlinedefined`, and `what`'
infowhat.l =
'`currentline`'
infowhat.t =
'`istailcall`'
infowhat.u['<5.1'] =
'`nups`'
infowhat.u['>5.2'] =
'`nups`, `nparams`, and `isvararg`'
infowhat.f =
'`func`'
infowhat.r =
'`ftransfer` and `ntransfer`'
infowhat.L =
'`activelines`'
hookmask.c =
'Calls hook when Lua calls a function.'
hookmask.r =
'Calls hook when Lua returns from a function.'
hookmask.l =
'Calls hook when Lua enters a new line of code.'
file =
''
file[':close'] =
'Close `file`.'
file[':flush'] =
'Saves any written data to `file`.'
file[':lines'] =
[[
------
```lua
for c in file:lines(...) do
body
end
```
]]
file[':read'] =
'Reads the `file`, according to the given formats, which specify what to read.'
file[':seek'] =
'Sets and gets the file position, measured from the beginning of the file.'
file[':setvbuf'] =
'Sets the buffering mode for an output file.'
file[':write'] =
'Writes the value of each of its arguments to `file`.'
readmode.n =
'Reads a numeral and returns it as number.'
readmode.a =
'Reads the whole file.'
readmode.l =
'Reads the next line skipping the end of line.'
readmode.L =
'Reads the next line keeping the end of line.'
seekwhence.set =
'Base is beginning of the file.'
seekwhence.cur =
'Base is current position.'
seekwhence['.end'] =
'Base is end of file.'
vbuf.no =
'Output operation appears immediately.'
vbuf.full =
'Performed only when the buffer is full.'
vbuf.line =
'Buffered until a newline is output.'
io =
''
io.stdin =
'standard input.'
io.stdout =
'standard output.'
io.stderr =
'standard error.'
io.close =
'Close `file` or default output file.'
io.flush =
'Saves any written data to default output file.'
io.input =
'Sets `file` as the default input file.'
io.lines =
[[
------
```lua
for c in io.lines(filename, ...) do
body
end
```
]]
io.open =
'Opens a file, in the mode specified in the string `mode`.'
io.output =
'Sets `file` as the default output file.'
io.popen =
'Starts program prog in a separated process.'
io.read =
'Reads the `file`, according to the given formats, which specify what to read.'
io.tmpfile =
'In case of success, returns a handle for a temporary file.'
io.type =
'Checks whether `obj` is a valid file handle.'
io.write =
'Writes the value of each of its arguments to default output file.'
openmode.r =
'Read mode.'
openmode.w =
'Write mode.'
openmode.a =
'Append mode.'
openmode['.r+'] =
'Update mode, all previous data is preserved.'
openmode['.w+'] =
'Update mode, all previous data is erased.'
openmode['.a+'] =
'Append update mode, previous data is preserved, writing is only allowed at the end of file.'
openmode.rb =
'Read mode. (in binary mode.)'
openmode.wb =
'Write mode. (in binary mode.)'
openmode.ab =
'Append mode. (in binary mode.)'
openmode['.r+b'] =
'Update mode, all previous data is preserved. (in binary mode.)'
openmode['.w+b'] =
'Update mode, all previous data is erased. (in binary mode.)'
openmode['.a+b'] =
'Append update mode, previous data is preserved, writing is only allowed at the end of file. (in binary mode.)'
popenmode.r =
'Read data from this program by `file`.'
popenmode.w =
'Write data to this program by `file`.'
filetype.file =
'Is an open file handle.'
filetype['.closed file'] =
'Is a closed file handle.'
filetype['.nil'] =
'Is not a file handle.'
math =
''
math.abs =
'Returns the absolute value of `x`.'
math.acos =
'Returns the arc cosine of `x` (in radians).'
math.asin =
'Returns the arc sine of `x` (in radians).'
math.atan['<5.2'] =
'Returns the arc tangent of `x` (in radians).'
math.atan['>5.3'] =
'Returns the arc tangent of `y/x` (in radians).'
math.atan2 =
'Returns the arc tangent of `y/x` (in radians).'
math.ceil =
'Returns the smallest integral value larger than or equal to `x`.'
math.cos =
'Returns the cosine of `x` (assumed to be in radians).'
math.cosh =
'Returns the hyperbolic cosine of `x` (assumed to be in radians).'
math.deg =
'Converts the angle `x` from radians to degrees.'
math.exp =
'Returns the value `e^x` (where `e` is the base of natural logarithms).'
math.floor =
'Returns the largest integral value smaller than or equal to `x`.'
math.fmod =
'Returns the remainder of the division of `x` by `y` that rounds the quotient towards zero.'
math.frexp =
'Decompose `x` into tails and exponents. Returns `m` and `e` such that `x = m * (2 ^ e)`, `e` is an integer and the absolute value of `m` is in the range [0.5, 1) (or zero when `x` is zero).'
math.huge =
'A value larger than any other numeric value.'
math.ldexp =
'Returns `m * (2 ^ e)` .'
math.log['<5.1'] =
'Returns the natural logarithm of `x` .'
math.log['>5.2'] =
'Returns the logarithm of `x` in the given base.'
math.log10 =
'Returns the base-10 logarithm of x.'
math.max =
'Returns the argument with the maximum value, according to the Lua operator `<`.'
math.maxinteger['>5.3'] =
'An integer with the maximum value for an integer.'
math.min =
'Returns the argument with the minimum value, according to the Lua operator `<`.'
math.mininteger['>5.3'] =
'An integer with the minimum value for an integer.'
math.modf =
'Returns the integral part of `x` and the fractional part of `x`.'
math.pi =
'The value of *π*.'
math.pow =
'Returns `x ^ y` .'
math.rad =
'Converts the angle `x` from degrees to radians.'
math.random =
[[
* `math.random()`: Returns a float in the range [0,1).
* `math.random(n)`: Returns a integer in the range [1, n].
* `math.random(m, n)`: Returns a integer in the range [m, n].
]]
math.randomseed['<5.3'] =
'Sets `x` as the "seed" for the pseudo-random generator.'
math.randomseed['>5.4'] =
[[
* `math.randomseed(x, y)`: Concatenate `x` and `y` into a 128-bit `seed` to reinitialize the pseudo-random generator.
* `math.randomseed(x)`: Equate to `math.randomseed(x, 0)` .
* `math.randomseed()`: Generates a seed with a weak attempt for randomness.
]]
math.sin =
'Returns the sine of `x` (assumed to be in radians).'
math.sinh =
'Returns the hyperbolic sine of `x` (assumed to be in radians).'
math.sqrt =
'Returns the square root of `x`.'
math.tan =
'Returns the tangent of `x` (assumed to be in radians).'
math.tanh =
'Returns the hyperbolic tangent of `x` (assumed to be in radians).'
math.tointeger['>5.3'] =
'If the value `x` is convertible to an integer, returns that integer.'
math.type['>5.3'] =
'Returns `"integer"` if `x` is an integer, `"float"` if it is a float, or `nil` if `x` is not a number.'
math.ult['>5.3'] =
'Returns `true` if and only if `m` is below `n` when they are compared as unsigned integers.'
os =
''
os.clock =
'Returns an approximation of the amount in seconds of CPU time used by the program.'
os.date =
'Returns a string or a table containing date and time, formatted according to the given string `format`.'
os.difftime =
'Returns the difference, in seconds, from time `t1` to time `t2`.'
os.execute =
'Passes `command` to be executed by an operating system shell.'
os.exit['<5.1'] =
'Calls the C function `exit` to terminate the host program.'
os.exit['>5.2'] =
'Calls the ISO C function `exit` to terminate the host program.'
os.getenv =
'Returns the value of the process environment variable `varname`.'
os.remove =
'Deletes the file with the given name.'
os.rename =
'Renames the file or directory named `oldname` to `newname`.'
os.setlocale =
'Sets the current locale of the program.'
os.time =
'Returns the current time when called without arguments, or a time representing the local date and time specified by the given table.'
os.tmpname =
'Returns a string with a file name that can be used for a temporary file.'
osdate.year =
'four digits'
osdate.month =
'1-12'
osdate.day =
'1-31'
osdate.hour =
'0-23'
osdate.min =
'0-59'
osdate.sec =
'0-61'
osdate.wday =
'weekday, 17, Sunday is 1'
osdate.yday =
'day of the year, 1366'
osdate.isdst =
'daylight saving flag, a boolean'
package =
''
require['<5.3'] =
'Loads the given module, returns any value returned by the given module(`true` when `nil`).'
require['>5.4'] =
'Loads the given module, returns any value returned by the searcher(`true` when `nil`). Besides that value, also returns as a second result the loader data returned by the searcher, which indicates how `require` found the module. (For instance, if the module came from a file, this loader data is the file path.)'
package.config =
'A string describing some compile-time configurations for packages.'
package.cpath =
'The path used by `require` to search for a C loader.'
package.loaded =
'A table used by `require` to control which modules are already loaded.'
package.loaders =
'A table used by `require` to control how to load modules.'
package.loadlib =
'Dynamically links the host program with the C library `libname`.'
package.path =
'The path used by `require` to search for a Lua loader.'
package.preload =
'A table to store loaders for specific modules.'
package.searchers =
'A table used by `require` to control how to load modules.'
package.searchpath =
'Searches for the given `name` in the given `path`.'
package.seeall =
'Sets a metatable for `module` with its `__index` field referring to the global environment, so that this module inherits values from the global environment. To be used as an option to function `module` .'
string =
''
string.byte =
'Returns the internal numeric codes of the characters `s[i], s[i+1], ..., s[j]`.'
string.char =
'Returns a string with length equal to the number of arguments, in which each character has the internal numeric code equal to its corresponding argument.'
string.dump =
'Returns a string containing a binary representation (a *binary chunk*) of the given function.'
string.find =
'Looks for the first match of `pattern` (see §6.4.1) in the string.'
string.format =
'Returns a formatted version of its variable number of arguments following the description given in its first argument.'
string.gmatch =
[[
Returns an iterator function that, each time it is called, returns the next captures from `pattern` (see §6.4.1) over the string s.
As an example, the following loop will iterate over all the words from string s, printing one per line:
```lua
s =
"hello world from Lua"
for w in string.gmatch(s, "%a+") do
print(w)
end
```
]]
string.gsub =
'Returns a copy of s in which all (or the first `n`, if given) occurrences of the `pattern` (see §6.4.1) have been replaced by a replacement string specified by `repl`.'
string.len =
'Returns its length.'
string.lower =
'Returns a copy of this string with all uppercase letters changed to lowercase.'
string.match =
'Looks for the first match of `pattern` (see §6.4.1) in the string.'
string.pack =
'Returns a binary string containing the values `v1`, `v2`, etc. packed (that is, serialized in binary form) according to the format string `fmt` (see §6.4.2) .'
string.packsize =
'Returns the size of a string resulting from `string.pack` with the given format string `fmt` (see §6.4.2) .'
string.rep['>5.2'] =
'Returns a string that is the concatenation of `n` copies of the string `s` separated by the string `sep`.'
string.rep['<5.1'] =
'Returns a string that is the concatenation of `n` copies of the string `s` .'
string.reverse =
'Returns a string that is the string `s` reversed.'
string.sub =
'Returns the substring of the string that starts at `i` and continues until `j`.'
string.unpack =
'Returns the values packed in string according to the format string `fmt` (see §6.4.2) .'
string.upper =
'Returns a copy of this string with all lowercase letters changed to uppercase.'
table =
''
table.concat =
'Given a list where all elements are strings or numbers, returns the string `list[i]..sep..list[i+1] ··· sep..list[j]`.'
table.insert =
'Inserts element `value` at position `pos` in `list`.'
table.maxn =
'Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices.'
table.move =
[[
Moves elements from table `a1` to table `a2`.
```lua
a2[t],··· =
a1[f],···,a1[e]
return a2
```
]]
table.pack =
'Returns a new table with all arguments stored into keys `1`, `2`, etc. and with a field `"n"` with the total number of arguments.'
table.remove =
'Removes from `list` the element at position `pos`, returning the value of the removed element.'
table.sort =
'Sorts list elements in a given order, *in-place*, from `list[1]` to `list[#list]`.'
table.unpack =
[[
Returns the elements from the given list. This function is equivalent to
```lua
return list[i], list[i+1], ···, list[j]
```
By default, `i` is `1` and `j` is `#list`.
]]
table.foreach =
'Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.'
table.foreachi =
'Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.'
table.getn =
'Returns the number of elements in the table. This function is equivalent to `#list`.'
table.new =
[[This creates a pre-sized table, just like the C API equivalent `lua_createtable()`. This is useful for big tables if the final table size is known and automatic table resizing is too expensive. `narray` parameter specifies the number of array-like items, and `nhash` parameter specifies the number of hash-like items. The function needs to be required before use.
```lua
require("table.new")
```
]]
table.clear =
[[This clears all keys and values from a table, but preserves the allocated array/hash sizes. This is useful when a table, which is linked from multiple places, needs to be cleared and/or when recycling a table for use by the same context. This avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth. The function needs to be required before use.
```lua
require("table.clear").
```
Please note this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work.
]]
utf8 =
''
utf8.char =
'Receives zero or more integers, converts each one to its corresponding UTF-8 byte sequence and returns a string with the concatenation of all these sequences.'
utf8.charpattern =
'The pattern which matches exactly one UTF-8 byte sequence, assuming that the subject is a valid UTF-8 string.'
utf8.codes =
[[
Returns values so that the construction
```lua
for p, c in utf8.codes(s) do
body
end
```
will iterate over all UTF-8 characters in string s, with p being the position (in bytes) and c the code point of each character. It raises an error if it meets any invalid byte sequence.
]]
utf8.codepoint =
'Returns the codepoints (as integers) from all characters in `s` that start between byte position `i` and `j` (both included).'
utf8.len =
'Returns the number of UTF-8 characters in string `s` that start between positions `i` and `j` (both inclusive).'
utf8.offset =
'Returns the position (in bytes) where the encoding of the `n`-th character of `s` (counting from position `i`) starts.'

View file

@ -0,0 +1,436 @@
---@diagnostic disable: undefined-global
config.addonManager.enable =
"Whether the addon manager is enabled or not."
config.runtime.version =
"Lua runtime version."
config.runtime.path =
[[
When using `require`, how to find the file based on the input name.
Setting this config to `?/init.lua` means that when you enter `require 'myfile'`, `${workspace}/myfile/init.lua` will be searched from the loaded files.
if `runtime.pathStrict` is `false`, `${workspace}/**/myfile/init.lua` will also be searched.
If you want to load files outside the workspace, you need to set `Lua.workspace.library` first.
]]
config.runtime.pathStrict =
'When enabled, `runtime.path` will only search the first level of directories, see the description of `runtime.path`.'
config.runtime.special =
[[The custom global variables are regarded as some special built-in variables, and the language server will provide special support
The following example shows that 'include' is treated as' require '.
```json
"Lua.runtime.special" : {
"include" : "require"
}
```
]]
config.runtime.unicodeName =
"Allows Unicode characters in name."
config.runtime.nonstandardSymbol =
"Supports non-standard symbols. Make sure that your runtime environment supports these symbols."
config.runtime.plugin =
"Plugin path. Please read [wiki](https://luals.github.io/wiki/plugins) to learn more."
config.runtime.pluginArgs =
"Additional arguments for the plugin."
config.runtime.fileEncoding =
"File encoding. The `ansi` option is only available under the `Windows` platform."
config.runtime.builtin =
[[
Adjust the enabled state of the built-in library. You can disable (or redefine) the non-existent library according to the actual runtime environment.
* `default`: Indicates that the library will be enabled or disabled according to the runtime version
* `enable`: always enable
* `disable`: always disable
]]
config.runtime.meta =
'Format of the directory name of the meta files.'
config.diagnostics.enable =
"Enable diagnostics."
config.diagnostics.disable =
"Disabled diagnostic (Use code in hover brackets)."
config.diagnostics.globals =
"Defined global variables."
config.diagnostics.severity =
[[
Modify the diagnostic severity.
End with `!` means override the group setting `diagnostics.groupSeverity`.
]]
config.diagnostics.neededFileStatus =
[[
* Opened: only diagnose opened files
* Any: diagnose all files
* None: disable this diagnostic
End with `!` means override the group setting `diagnostics.groupFileStatus`.
]]
config.diagnostics.groupSeverity =
[[
Modify the diagnostic severity in a group.
`Fallback` means that diagnostics in this group are controlled by `diagnostics.severity` separately.
Other settings will override individual settings without end of `!`.
]]
config.diagnostics.groupFileStatus =
[[
Modify the diagnostic needed file status in a group.
* Opened: only diagnose opened files
* Any: diagnose all files
* None: disable this diagnostic
`Fallback` means that diagnostics in this group are controlled by `diagnostics.neededFileStatus` separately.
Other settings will override individual settings without end of `!`.
]]
config.diagnostics.workspaceEvent =
"Set the time to trigger workspace diagnostics."
config.diagnostics.workspaceEvent.OnChange =
"Trigger workspace diagnostics when the file is changed."
config.diagnostics.workspaceEvent.OnSave =
"Trigger workspace diagnostics when the file is saved."
config.diagnostics.workspaceEvent.None =
"Disable workspace diagnostics."
config.diagnostics.workspaceDelay =
"Latency (milliseconds) for workspace diagnostics."
config.diagnostics.workspaceRate =
"Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also reduces the speed of workspace diagnostics. The diagnosis of the file you are currently editing is always done at full speed and is not affected by this setting."
config.diagnostics.libraryFiles =
"How to diagnose files loaded via `Lua.workspace.library`."
config.diagnostics.libraryFiles.Enable =
"Always diagnose these files."
config.diagnostics.libraryFiles.Opened =
"Only when these files are opened will it be diagnosed."
config.diagnostics.libraryFiles.Disable =
"These files are not diagnosed."
config.diagnostics.ignoredFiles =
"How to diagnose ignored files."
config.diagnostics.ignoredFiles.Enable =
"Always diagnose these files."
config.diagnostics.ignoredFiles.Opened =
"Only when these files are opened will it be diagnosed."
config.diagnostics.ignoredFiles.Disable =
"These files are not diagnosed."
config.diagnostics.disableScheme =
'Do not diagnose Lua files that use the following scheme.'
config.diagnostics.unusedLocalExclude =
'Do not diagnose `unused-local` when the variable name matches the following pattern.'
config.workspace.ignoreDir =
"Ignored files and directories (Use `.gitignore` grammar)."-- .. example.ignoreDir,
config.workspace.ignoreSubmodules =
"Ignore submodules."
config.workspace.useGitIgnore =
"Ignore files list in `.gitignore` ."
config.workspace.maxPreload =
"Max preloaded files."
config.workspace.preloadFileSize =
"Skip files larger than this value (KB) when preloading."
config.workspace.library =
"In addition to the current workspace, which directories will load files from. The files in these directories will be treated as externally provided code libraries, and some features (such as renaming fields) will not modify these files."
config.workspace.checkThirdParty =
[[
Automatic detection and adaptation of third-party libraries, currently supported libraries are:
* OpenResty
* Cocos4.0
* LÖVE
* LÖVR
* skynet
* Jass
]]
config.workspace.userThirdParty =
'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)'
config.workspace.supportScheme =
'Provide language server for the Lua files of the following scheme.'
config.completion.enable =
'Enable completion.'
config.completion.callSnippet =
'Shows function call snippets.'
config.completion.callSnippet.Disable =
"Only shows `function name`."
config.completion.callSnippet.Both =
"Shows `function name` and `call snippet`."
config.completion.callSnippet.Replace =
"Only shows `call snippet.`"
config.completion.keywordSnippet =
'Shows keyword syntax snippets.'
config.completion.keywordSnippet.Disable =
"Only shows `keyword`."
config.completion.keywordSnippet.Both =
"Shows `keyword` and `syntax snippet`."
config.completion.keywordSnippet.Replace =
"Only shows `syntax snippet`."
config.completion.displayContext =
"Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled."
config.completion.workspaceWord =
"Whether the displayed context word contains the content of other files in the workspace."
config.completion.showWord =
"Show contextual words in suggestions."
config.completion.showWord.Enable =
"Always show context words in suggestions."
config.completion.showWord.Fallback =
"Contextual words are only displayed when suggestions based on semantics cannot be provided."
config.completion.showWord.Disable =
"Do not display context words."
config.completion.autoRequire =
"When the input looks like a file name, automatically `require` this file."
config.completion.showParams =
"Display parameters in completion list. When the function has multiple definitions, they will be displayed separately."
config.completion.requireSeparator =
"The separator used when `require`."
config.completion.postfix =
"The symbol used to trigger the postfix suggestion."
config.color.mode =
"Color mode."
config.color.mode.Semantic =
"Semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect."
config.color.mode.SemanticEnhanced =
"Enhanced semantic color. Like `Semantic`, but with additional analysis which might be more computationally expensive."
config.color.mode.Grammar =
"Grammar color."
config.semantic.enable =
"Enable semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect."
config.semantic.variable =
"Semantic coloring of variables/fields/parameters."
config.semantic.annotation =
"Semantic coloring of type annotations."
config.semantic.keyword =
"Semantic coloring of keywords/literals/operators. You only need to enable this feature if your editor cannot do syntax coloring."
config.signatureHelp.enable =
"Enable signature help."
config.hover.enable =
"Enable hover."
config.hover.viewString =
"Hover to view the contents of a string (only if the literal contains an escape character)."
config.hover.viewStringMax =
"The maximum length of a hover to view the contents of a string."
config.hover.viewNumber =
"Hover to view numeric content (only if literal is not decimal)."
config.hover.fieldInfer =
"When hovering to view a table, type infer will be performed for each field. When the accumulated time of type infer reaches the set value (MS), the type infer of subsequent fields will be skipped."
config.hover.previewFields =
"When hovering to view a table, limits the maximum number of previews for fields."
config.hover.enumsLimit =
"When the value corresponds to multiple types, limit the number of types displaying."
config.hover.expandAlias =
[[
Whether to expand the alias. For example, expands `---@alias myType boolean|number` appears as `boolean|number`, otherwise it appears as `myType'.
]]
config.develop.enable =
'Developer mode. Do not enable, performance will be affected.'
config.develop.debuggerPort =
'Listen port of debugger.'
config.develop.debuggerWait =
'Suspend before debugger connects.'
config.intelliSense.searchDepth =
'Set the search depth for IntelliSense. Increasing this value increases accuracy, but decreases performance. Different workspace have different tolerance for this setting. Please adjust it to the appropriate value.'
config.intelliSense.fastGlobal =
'In the global variable completion, and view `_G` suspension prompt. This will slightly reduce the accuracy of type speculation, but it will have a significant performance improvement for projects that use a lot of global variables.'
config.window.statusBar =
'Show extension status in status bar.'
config.window.progressBar =
'Show progress bar in status bar.'
config.hint.enable =
'Enable inlay hint.'
config.hint.paramType =
'Show type hints at the parameter of the function.'
config.hint.setType =
'Show hints of type at assignment operation.'
config.hint.paramName =
'Show hints of parameter name at the function call.'
config.hint.paramName.All =
'All types of parameters are shown.'
config.hint.paramName.Literal =
'Only literal type parameters are shown.'
config.hint.paramName.Disable =
'Disable parameter hints.'
config.hint.arrayIndex =
'Show hints of array index when constructing a table.'
config.hint.arrayIndex.Enable =
'Show hints in all tables.'
config.hint.arrayIndex.Auto =
'Show hints only when the table is greater than 3 items, or the table is a mixed table.'
config.hint.arrayIndex.Disable =
'Disable hints of array index.'
config.hint.await =
'If the called function is marked `---@async`, prompt `await` at the call.'
config.hint.semicolon =
'If there is no semicolon at the end of the statement, display a virtual semicolon.'
config.hint.semicolon.All =
'All statements display virtual semicolons.'
config.hint.semicolon.SameLine =
'When two statements are on the same line, display a semicolon between them.'
config.hint.semicolon.Disable =
'Disable virtual semicolons.'
config.codeLens.enable =
'Enable code lens.'
config.format.enable =
'Enable code formatter.'
config.format.defaultConfig =
[[
The default format configuration. Has a lower priority than `.editorconfig` file in the workspace.
Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage.
]]
config.spell.dict =
'Custom words for spell checking.'
config.nameStyle.config =
'Set name style config'
config.telemetry.enable =
[[
Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://luals.github.io/privacy/#language-server).
]]
config.misc.parameters =
'[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language server in VSCode.'
config.misc.executablePath =
'Specify the executable path in VSCode.'
config.type.castNumberToInteger =
'Allowed to assign the `number` type to the `integer` type.'
config.type.weakUnionCheck =
[[
Once one subtype of a union type meets the condition, the union type also meets the condition.
When this setting is `false`, the `number|boolean` type cannot be assigned to the `number` type. It can be with `true`.
]]
config.type.weakNilCheck =
[[
When checking the type of union type, ignore the `nil` in it.
When this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.
]]
config.doc.privateName =
'Treat specific field names as private, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are private, witch can only be accessed in the class where the definition is located.'
config.doc.protectedName =
'Treat specific field names as protected, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are protected, witch can only be accessed in the class where the definition is located and its subclasses.'
config.doc.packageName =
'Treat specific field names as package, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are package, witch can only be accessed in the file where the definition is located.'
config.diagnostics['unused-local'] =
'Enable unused local variable diagnostics.'
config.diagnostics['unused-function'] =
'Enable unused function diagnostics.'
config.diagnostics['undefined-global'] =
'Enable undefined global variable diagnostics.'
config.diagnostics['global-in-nil-env'] =
'Enable cannot use global variables `_ENV` is set to `nil` diagnostics.'
config.diagnostics['unused-label'] =
'Enable unused label diagnostics.'
config.diagnostics['unused-vararg'] =
'Enable unused vararg diagnostics.'
config.diagnostics['trailing-space'] =
'Enable trailing space diagnostics.'
config.diagnostics['redefined-local'] =
'Enable redefined local variable diagnostics.'
config.diagnostics['newline-call'] =
'Enable newline call diagnostics. Is\'s raised when a line starting with `(` is encountered, which is syntactically parsed as a function call on the previous line.'
config.diagnostics['newfield-call'] =
'Enable newfield call diagnostics. It is raised when the parenthesis of a function call appear on the following line when defining a field in a table.'
config.diagnostics['redundant-parameter'] =
'Enable redundant function parameter diagnostics.'
config.diagnostics['ambiguity-1'] =
'Enable ambiguous operator precedence diagnostics. For example, the `num or 0 + 1` expression will be suggested `(num or 0) + 1` instead.'
config.diagnostics['lowercase-global'] =
'Enable lowercase global variable definition diagnostics.'
config.diagnostics['undefined-env-child'] =
'Enable undefined environment variable diagnostics. It\'s raised when `_ENV` table is set to a new literal table, but the used global variable is no longer present in the global environment.'
config.diagnostics['duplicate-index'] =
'Enable duplicate table index diagnostics.'
config.diagnostics['empty-block'] =
'Enable empty code block diagnostics.'
config.diagnostics['redundant-value'] =
'Enable the redundant values assigned diagnostics. It\'s raised during assignment operation, when the number of values is higher than the number of objects being assigned.'
config.diagnostics['assign-type-mismatch'] =
'Enable diagnostics for assignments in which the value\'s type does not match the type of the assigned variable.'
config.diagnostics['await-in-sync'] =
'Enable diagnostics for calls of asynchronous functions within a synchronous function.'
config.diagnostics['cast-local-type'] =
'Enable diagnostics for casts of local variables where the target type does not match the defined type.'
config.diagnostics['cast-type-mismatch'] =
'Enable diagnostics for casts where the target type does not match the initial type.'
config.diagnostics['circular-doc-class'] =
'Enable diagnostics for two classes inheriting from each other introducing a circular relation.'
config.diagnostics['close-non-object'] =
'Enable diagnostics for attempts to close a variable with a non-object.'
config.diagnostics['code-after-break'] =
'Enable diagnostics for code placed after a break statement in a loop.'
config.diagnostics['codestyle-check'] =
'Enable diagnostics for incorrectly styled lines.'
config.diagnostics['count-down-loop'] =
'Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing.'
config.diagnostics['deprecated'] =
'Enable diagnostics to highlight deprecated API.'
config.diagnostics['different-requires'] =
'Enable diagnostics for files which are required by two different paths.'
config.diagnostics['discard-returns'] =
'Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored.'
config.diagnostics['doc-field-no-class'] =
'Enable diagnostics to highlight a field annotation without a defining class annotation.'
config.diagnostics['duplicate-doc-alias'] =
'Enable diagnostics for a duplicated alias annotation name.'
config.diagnostics['duplicate-doc-field'] =
'Enable diagnostics for a duplicated field annotation name.'
config.diagnostics['duplicate-doc-param'] =
'Enable diagnostics for a duplicated param annotation name.'
config.diagnostics['duplicate-set-field'] =
'Enable diagnostics for setting the same field in a class more than once.'
config.diagnostics['incomplete-signature-doc'] =
'Incomplete @param or @return annotations for functions.'
config.diagnostics['invisible'] =
'Enable diagnostics for accesses to fields which are invisible.'
config.diagnostics['missing-global-doc'] =
'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.'
config.diagnostics['missing-local-export-doc'] =
'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.'
config.diagnostics['missing-parameter'] =
'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.'
config.diagnostics['missing-return'] =
'Enable diagnostics for functions with return annotations which have no return statement.'
config.diagnostics['missing-return-value'] =
'Enable diagnostics for return statements without values although the containing function declares returns.'
config.diagnostics['need-check-nil'] =
'Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.'
config.diagnostics['no-unknown'] =
'Enable diagnostics for cases in which the type cannot be inferred.'
config.diagnostics['not-yieldable'] =
'Enable diagnostics for calls to `coroutine.yield()` when it is not permitted.'
config.diagnostics['param-type-mismatch'] =
'Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition.'
config.diagnostics['redundant-return'] =
'Enable diagnostics for return statements which are not needed because the function would exit on its own.'
config.diagnostics['redundant-return-value']=
'Enable diagnostics for return statements which return an extra value which is not specified by a return annotation.'
config.diagnostics['return-type-mismatch'] =
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
config.diagnostics['spell-check'] =
'Enable diagnostics for typos in strings.'
config.diagnostics['name-style-check'] =
'Enable diagnostics for name style.'
config.diagnostics['unbalanced-assignments']=
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
config.diagnostics['undefined-doc-class'] =
'Enable diagnostics for class annotations in which an undefined class is referenced.'
config.diagnostics['undefined-doc-name'] =
'Enable diagnostics for type annotations referencing an undefined type or alias.'
config.diagnostics['undefined-doc-param'] =
'Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition.'
config.diagnostics['undefined-field'] =
'Enable diagnostics for cases in which an undefined field of a variable is read.'
config.diagnostics['unknown-cast-variable'] =
'Enable diagnostics for casts of undefined variables.'
config.diagnostics['unknown-diag-code'] =
'Enable diagnostics in cases in which an unknown diagnostics code is entered.'
config.diagnostics['unknown-operator'] =
'Enable diagnostics for unknown operators.'
config.diagnostics['unreachable-code'] =
'Enable diagnostics for unreachable code.'
config.diagnostics['global-element'] =
'Enable diagnostics to warn about global elements.'
config.typeFormat.config =
'Configures the formatting behavior while typing Lua code.'
config.typeFormat.config.auto_complete_end =
'Controls if `end` is automatically completed at suitable positions.'
config.typeFormat.config.auto_complete_table_sep =
'Controls if a separator is automatically appended at the end of a table declaration.'
config.typeFormat.config.format_line =
'Controls if a line is formatted at all.'
command.exportDocument =
'Lua: Export Document ...'
command.addon_manager.open =
'Lua: Open Addon Manager ...'
command.reloadFFIMeta =
'Lua: Reload luajit ffi meta'

View file

@ -0,0 +1,764 @@
---@diagnostic disable: undefined-global, lowercase-global
arg =
'Argumentos de inicialização para a versão standalone da linguagem Lua.'
assert =
'Emite um erro se o valor de seu argumento v for falso (i.e., `nil` ou `false`); caso contrário, devolve todos os seus argumentos. Em caso de erro, `message` é o objeto de erro que, quando ausente, por padrão é `"assertion failed!"`'
cgopt.collect =
'Realiza um ciclo completo de coleta de lixo (i.e., garbage-collection cycle).'
cgopt.stop =
'Interrompe a execução automática.'
cgopt.restart =
'Reinicia a execução automática.'
cgopt.count =
'Retorna, em Kbytes, a quantidade total de memória utilizada pela linguagem Lua.'
cgopt.step =
'Executa a coleta de lixo (i.e., garbage-collection) em uma única etapa. A quantidade de execuções por etapa é controlada via `arg`.'
cgopt.setpause =
'Estabelece pausa. Defina via `arg` o intervalo de pausa do coletor de lixo (i.e., garbage-collection).'
cgopt.setstepmul =
'Estabelece um multiplicador para etapa de coleta de lixo (i.e., garbage-collection). Defina via `arg` o valor multiplicador.'
cgopt.incremental =
'Altera o modo do coletor para incremental.'
cgopt.generational =
'Altera o modo do coletor para geracional.'
cgopt.isrunning =
'Retorna um valor booleano indicando se o coletor de lixo (i.e., garbage-collection) está em execução.'
collectgarbage =
'Esta função é uma interface genérica para o coletor de lixo (i.e., garbage-collection). Ela executa diferentes funções de acordo com seu primeiro argumento, `opt`.'
dofile =
'Abre o arquivo fornecido por argumento e executa seu conteúdo como código Lua. Quando chamado sem argumentos, `dofile` executa o conteúdo da entrada padrão (`stdin`). Retorna todos os valores retornados pelo trecho de código contido no arquivo. Em caso de erros, o `dofile` propaga o erro para seu chamador. Ou seja, o `dofile` não funciona em modo protegido.'
error =
[[
Termina a última chamada de função protegida e retorna `message` como objeto de `erro`.
Normalmente, o 'erro' adiciona algumas informações sobre a localização do erro no início da mensagem, quando a mensagem for uma string.
]]
_G =
'Uma variável global (não uma função) que detém o ambiente global (ver §2.2). Lua em si não usa esta variável; mudar seu valor não afeta nenhum ambiente e vice-versa.'
getfenv =
'Retorna o ambiente atual em uso pela função. O `f` pode ser uma função Lua ou um número que especifica a função naquele nível de pilha.'
getmetatable =
'Se o objeto não tiver uma metatable, o retorno é `nil`. Mas caso a metatable do objeto tenha um campo `__metatable`, é retornado o valor associado. Caso contrário, retorna a metatable do objeto dado.'
ipairs =
[[
Retorna três valores (uma função iteradora, a tabela `t`, e `0`) para que a seguinte construção
```lua
for i,v in ipairs(t) do body end
```
possa iterar sobre os pares de valor-chave `(1,t[1]), (2,t[2]), ...`, até o primeiro índice ausente.
]]
loadmode.b =
'Somente blocos binários.'
loadmode.t =
'Somente blocos de texto.'
loadmode.bt =
'Tanto binário quanto texto.'
load['<5.1'] =
'Carrega um bloco utilizando a função `func` para obter suas partes. Cada chamada para o `func` deve retornar uma string que é concatenada com os resultados anteriores.'
load['>5.2'] =
[[
Carrega um bloco.
Se o bloco (i.e., `chunk`) é uma string, o bloco é essa string. Se o bloco é uma função, a função "load" é chamada repetidamente para obter suas partes. Cada chamada para o bloco deve retornar uma string que é concatenada com os resultados anteriores. O fim do bloco é sinalizado com o retorno de uma string vazia ou `nil`.
]]
loadfile =
'Carrega um bloco de arquivo `filename` ou da entrada padrão, se nenhum nome de arquivo for dado.'
loadstring =
'Carrega um bloco a partir de uma string dada.'
module =
'Cria um módulo.'
next =
[[
Permite que um programa percorra todos os campos de uma tabela. Seu primeiro argumento é uma tabela e seu segundo argumento é um índice nesta tabela. Uma chamada `next` retorna o próximo índice da tabela e seu valor associado. Quando chamado usando `nil` como segundo argumento, `next` retorna um índice inicial e seu valor associado. Quando chamado com o último índice, ou com `nil` em uma tabela vazia, o `next` retorna o `nil`. Se o segundo argumento estiver ausente, então é interpretado como `nil`. Portanto, pode-se utilizar o `next(t)` para verificar se uma tabela está vazia.
A ordem na qual os índices são enumerados não é especificada, *mesmo para índices numéricos*. (Para percorrer uma tabela em ordem numérica, utilize um `for`).
O comportamento do `next` é indefinido se, durante a iteração/travessia, você atribuir qualquer valor a um campo inexistente na tabela. Você pode, entretanto, modificar os campos existentes e pode, inclusive, os definir como nulos.
]]
pairs =
[[
Se `t` tem um "meta" método (i.e., metamethod) `__pairs`, a chamada é feita usando t como argumento e retorna os três primeiros resultados.
Caso contrário, retorna três valores: a função $next, a tabela `t` e `nil`, para que a seguinte construção
```lua
for k,v in pairs(t) do body end
```
possa iterar sobre todos os pares de valor-chave da tabela 't'.
Veja a função $next para saber as ressalvas em modificar uma tabela durante sua iteração.
]]
pcall =
[[
Chama a função `f` com os argumentos dados em modo *protegido*. Isto significa que qualquer erro dentro de `f` não é propagado; em vez disso, o `pcall` captura o erro e retorna um código de status. Seu primeiro resultado é o código de status (booleano), que é verdadeiro se a chamada for bem sucedida sem erros. Neste caso, `pcall' também retorna todos os resultados da chamada, após este primeiro resultado. Em caso de qualquer erro, `pcall` retorna `false` mais o objeto de erro.
]]
print =
[[
Recebe qualquer número de argumentos e imprime seus valores na saída padrão `stdout`, convertendo cada argumento em uma string seguindo as mesmas regras do $tostring.
A função `print` não é destinada à saída formatada, mas apenas como uma forma rápida de mostrar um valor, por exemplo, para debugging. Para controle completo sobre a saída, use $string.format e $io.write.
]]
rawequal =
'Verifica se v1 é igual a v2, sem invocar a metatable `__eq`.'
rawget =
'Obtém o valor real de `table[index]`, sem invocar a metatable `__index`.'
rawlen =
'Retorna o comprimento do objeto `v`, sem invocar a metatable `__len`.'
rawset =
[[
Define o valor real de `table[index]` para `value`, sem utilizar o metavalue `__newindex`. `table` deve ser uma tabela, `index` qualquer valor diferente de `nil` e `NaN`, e `value` qualquer valor de tipos do Lua.
Esta função retorna uma `table`.
]]
select =
'Se `index` é um número, retorna todos os argumentos após o número do argumento `index`; um número negativo de índices do final (`-1` é o último argumento). Caso contrário, `index` deve ser a string `"#"`, e `select` retorna o número total de argumentos extras dados.'
setfenv =
'Define o ambiente a ser utilizado pela função em questão.'
setmetatable =
[[
Define a metatable para a tabela dada. Se `metatabela` for `nil`, remove a metatable da tabela em questão. Se a metatable original tiver um campo `__metatable', um erro é lançado.
Esta função retorna uma `table`.
Para alterar a metatable de outros tipos do código Lua, você deve utilizar a biblioteca de debugging (§6.10).
]]
tonumber =
[[
Quando chamado sem a base, `tonumber` tenta converter seu argumento para um número. Se o argumento for um número ou uma string numérica, então `tonumber` retorna este número; caso contrário, retorna `fail`.
A conversão de strings pode resultar em números inteiros ou de ponto flutuante, de acordo com as convenções lexicais de Lua (ver §3.1). A string pode ter espaços antes e depois e um sinal.
]]
tostring =
[[
Recebe um valor de qualquer tipo e o converte em uma string em formato legível por humanos.
Se a metatable de `v` tem um campo `__tostring', então `tostring' chama o valor correspondente usando `v` como argumento, e utiliza o resultado da chamada como seu resultado. Caso contrário, se a metatable de `v` tiver um campo `__name` com um valor do tipo string, `tostring` pode utilizar essa string em seu resultado final.
Para controle completo de como os números são convertidos, utilize $string.format.
]]
type =
[[
Retorna o tipo de seu único argumento, codificado como uma string. Os resultados possíveis desta função são `"nil"` (uma string, não o valor `nil`), `"number"`, `"string"`, `"boolean"`, `"table"`, `"function"`, `"thread"`, e `"userdata"`.
]]
_VERSION =
'Uma variável global (não uma função) que contém uma string contendo a versão Lua em execução.'
warn =
'Emite um aviso com uma mensagem composta pela concatenação de todos os seus argumentos (que devem ser strings).'
xpcall['=5.1'] =
'Faz chamada a função `f` com os argumentos dados e em modo protegido, usando um manipulador de mensagens dado.'
xpcall['>5.2'] =
'Faz chamada a função `f` com os argumentos dados e em modo protegido, usando um manipulador de mensagens dado.'
unpack =
[[
Retorna os elementos da lista dada. Esta função é equivalente a
```lua
return list[i], list[i+1], ···, list[j]
```
]]
bit32 =
''
bit32.arshift =
[[
Retorna o número `x` deslocado `disp` bits para a direita. Deslocamentos negativos movem os bits para a esquerda.
Esta operação de deslocamento é chamada de deslocamento aritmético. Os bits vagos à esquerda são preenchidos com cópias do bit mais significativo de `x`; os bits vagos à direita são preenchidos com zeros.
]]
bit32.band =
'Retorna a operação bitwise *and* de seus operandos.'
bit32.bnot =
[[
Retorna a negação da operação bitwise de `x`.
```lua
assert(bit32.bnot(x) ==
(-1 - x) % 2^32)
```
]]
bit32.bor =
'Retorna a operação bitwise *or* de seus operandos.'
bit32.btest =
'Retorna um valor booleano verdadeiro se a operação bitwise *and* de seus operandos for diferente de zero. Falso, caso contrário.'
bit32.bxor =
'Retorna a operação bitwise *exclusive or* de seus operandos.'
bit32.extract =
'Retorna o número formado pelos bits de `field` a `field + width - 1` de `n`, sem sinal.'
bit32.replace =
'Retorna uma cópia de `n` com os bits de `field` a `field + width - 1` substituídos pelo valor `v` .'
bit32.lrotate =
'Retorna o número `x` rotacionado `disp` bits para a esquerda. Rotações negativos movem os bits para a direita. '
bit32.lshift =
[[
Retorna o número `x` deslocado `disp` bits para a esquerda. Deslocamentos negativos movem os bits para a direita. Em ambas as direções, os bits vazios/vagos são preenchidos com zeros.
```lua
assert(bit32.lshift(b, disp) ==
(b * 2^disp) % 2^32)
```
]]
bit32.rrotate =
'Retorna o número `x` rotacionado `disp` bits para a direita. Deslocamentos negativos movem os bits para a esquerda.'
bit32.rshift =
[[
Retorna o número `x` deslocado `disp` bits para a direita. Deslocamentos negativos movem os bits para a esquerda. Em ambas as direções, os bits vazios são preenchidos com zeros.
```lua
assert(bit32.rshift(b, disp) ==
math.floor(b % 2^32 / 2^disp))
```
]]
coroutine =
''
coroutine.create =
'Cria uma nova `coroutine`, a partir de uma função `f` e retorna esta coroutine como objeto do tipo `"thread"`.'
coroutine.isyieldable =
'Retorna verdadeiro quando a `coroutine` em execução for finalizada.'
coroutine.isyieldable['>5.4']=
'Retorna verdadeiro quando a `coroutine` `co` for finalizada. Por padrão `co` é uma coroutine em execução.'
coroutine.close =
'Finaliza a coroutine `co` , encerrando todas as variáveis pendentes e colocando a coroutine em um estado morto.'
coroutine.resume =
'Inicia ou continua a execução da coroutine `co`.'
coroutine.running =
'Retorna a `coroutine` corrente e um booleana verdadeiro quando a coroutine corrente é a principal.'
coroutine.status =
'Retorna o status da `coroutine `co`.'
coroutine.wrap =
'Cria uma nova `coroutine`, a partir de uma função `f` e retorna uma função que retorna a coroutine cada vez que ele é chamado.'
coroutine.yield =
'Suspende a execução da coroutine chamada.'
costatus.running =
'Está em execução.'
costatus.suspended =
'Está suspenso ou não foi iniciado.'
costatus.normal =
'Está ativo, mas não está em execução.'
costatus.dead =
'Terminou ou parou devido a erro'
debug =
''
debug.debug =
'Entra em modo interativo com o usuário, executando os comandos de entrada.'
debug.getfenv =
'Retorna o ambiente do objeto `o` .'
debug.gethook =
'Retorna as configurações do `hook` atual da `thread`.'
debug.getinfo =
'Retorna uma tabela com informações sobre uma função.'
debug.getlocal['<5.1'] =
'Retorna o nome e o valor da variável local com índice `local` da função de nível `level` da pilha.'
debug.getlocal['>5.2'] =
'Retorna o nome e o valor da variável local com índice `local` da função de nível `f` da pilha.'
debug.getmetatable =
'Retorna a `metatable` do valor dado.'
debug.getregistry =
'Retorna a tabela de registro.'
debug.getupvalue =
'Retorna o nome e o valor da variável antecedente com índice `up` da função.'
debug.getuservalue['<5.3'] =
'Retorna o valor de Lua associado a `u` (i.e., user).'
debug.getuservalue['>5.4'] =
[[
Retorna o `n`-ésimo valor de usuário associado
aos dados do usuário `u` e um booleano,
`false`, se nos dados do usuário não existir esse valor.
]]
debug.setcstacklimit =
[[
### **Deprecated in `Lua 5.4.2`**
Estabelece um novo limite para a pilha C. Este limite controla quão profundamente as chamadas aninhadas podem ir em Lua, com a intenção de evitar um transbordamento da pilha.
Em caso de sucesso, esta função retorna o antigo limite. Em caso de erro, ela retorna `false`.
]]
debug.setfenv =
'Define o ambiente do `object` dado para a `table` dada .'
debug.sethook =
'Define a função dada como um `hook`.'
debug.setlocal =
'Atribui o valor `value` à variável local com índice `local` da função de nível `level` da pilha.'
debug.setmetatable =
'Define a `metatable` com o valor dado para tabela dada (que pode ser `nil`).'
debug.setupvalue =
'Atribui `value` a variável antecedente com índice `up` da função.'
debug.setuservalue['<5.3'] =
'Define o valor dado como o valor Lua associado ao `udata` (i.e., user data).'
debug.setuservalue['>5.4'] =
[[
Define o valor dado como
o `n`-ésimo valor de usuário associado ao `udata` (i.e., user data).
O `udata` deve ser um dado de usuário completo.
]]
debug.traceback =
'Retorna uma string com um `traceback` de chamadas. A string de mensagen (opcional) é anexada no início do traceback.'
debug.upvalueid =
'Retorna um identificador único (como um dado de usuário leve) para o valor antecedente de numero `n` da função dada.'
debug.upvaluejoin =
'Faz o `n1`-ésimo valor da função `f1` (i.e., closure Lua) referir-se ao `n2`-ésimo valor da função `f2`.'
infowhat.n =
'`name` e `namewhat`'
infowhat.S =
'`source`, `short_src`, `linedefined`, `lastlinedefined` e `what`'
infowhat.l =
'`currentline`'
infowhat.t =
'`istailcall`'
infowhat.u['<5.1'] =
'`nups`'
infowhat.u['>5.2'] =
'`nups`, `nparams` e `isvararg`'
infowhat.f =
'`func`'
infowhat.r =
'`ftransfer` e `ntransfer`'
infowhat.L =
'`activelines`'
hookmask.c =
'Faz chamada a um `hook` quando o Lua chama uma função.'
hookmask.r =
'Faz chamada a um `hook` quando o retorno de uma função é executado.'
hookmask.l =
'Faz chamada a um `hook` quando encontra nova linha de código.'
file =
''
file[':close'] =
'Fecha o arquivo `file`.'
file[':flush'] =
'Salva qualquer dado de entrada no arquivo `file`.'
file[':lines'] =
[[
------
```lua
for c in file:lines(...) do
body
end
```
]]
file[':read'] =
'Lê o arquivo de acordo com o formato fornecido e que especifica o que deve ser lido.'
file[':seek'] =
'Define e obtém a posição do arquivo, medida a partir do início do arquivo.'
file[':setvbuf'] =
'Define o modo de `buffer` para um arquivo de saída.'
file[':write'] =
'Escreve o valor de cada um de seus argumentos no arquivo.'
readmode.n =
'Lê um numeral e o devolve como número.'
readmode.a =
'Lê o arquivo completo.'
readmode.l =
'Lê a próxima linha pulando o final da linha.'
readmode.L =
'Lê a próxima linha mantendo o final da linha.'
seekwhence.set =
'O cursor base é o início do arquivo.'
seekwhence.cur =
'O cursor base é a posição atual.'
seekwhence['.end'] =
'O cursor base é o final do arquivo.'
vbuf.no =
'A saída da operação aparece imediatamente.'
vbuf.full =
'Realizado apenas quando o `buffer` está cheio.'
vbuf.line =
'`Buffered` até que uma nova linha seja encontrada.'
io =
''
io.stdin =
'Entrada padrão.'
io.stdout =
'Saída padrão.'
io.stderr =
'Erro padrão.'
io.close =
'Fecha o arquivo dado ou o arquivo de saída padrão.'
io.flush =
'Salva todos os dados gravados no arquivo de saída padrão.'
io.input =
'Define o arquivo de entrada padrão.'
io.lines =
[[
------
```lua
for c in io.lines(filename, ...) do
body
end
```
]]
io.open =
'Abre um arquivo no modo especificado pela *string* `mode`.'
io.output =
'Define o arquivo de saída padrão.'
io.popen =
'Inicia o programa dado em um processo separado.'
io.read =
'Lê o arquivo de acordo com o formato fornecido e que especifica o que deve ser lido.'
io.tmpfile =
'Em caso de sucesso, retorna um `handler` para um arquivo temporário.'
io.type =
'Verifica se `obj` é um identificador de arquivo válido.'
io.write =
'Escreve o valor de cada um dos seus argumentos para o arquivo de saída padrão.'
openmode.r =
'Modo de leitura.'
openmode.w =
'Modo de escrita.'
openmode.a =
'Modo de anexação.'
openmode['.r+'] =
'Modo de atualização, todos os dados anteriores são preservados.'
openmode['.w+'] =
'Modo de atualização, todos os dados anteriores são apagados.'
openmode['.a+'] =
'Modo de anexação e atualização, os dados anteriores são preservados, a escrita só é permitida no final do arquivo.'
openmode.rb =
'Modo de leitura. (em modo binário)'
openmode.wb =
'Modo de escrita. (em modo binário)'
openmode.ab =
'Modo de anexação. (em modo binário)'
openmode['.r+b'] =
'Modo de atualização, todos os dados anteriores são preservados. (em modo binário)'
openmode['.w+b'] =
'Modo de atualização, todos os dados anteriores são apagados. (em modo binário)'
openmode['.a+b'] =
'Modo de anexação e atualização, todos os dados anteriores são preservados, a escrita só é permitida no final do arquivo. (em modo binário)'
popenmode.r =
'Leia dados deste programa pelo arquivo.'
popenmode.w =
'Escreva dados neste programa pelo arquivo.'
filetype.file =
'`handler` para arquivo aberto.'
filetype['.closed file'] =
'`handler` para arquivo fechado.'
filetype['.nil'] =
'Não é um `handler` de arquivo'
math =
''
math.abs =
'Retorna o valor absoluto de `x`.'
math.acos =
'Retorna o arco cosseno de `x` (em radianos).'
math.asin =
'Retorna o arco seno de `x` (em radianos).'
math.atan['<5.2'] =
'Retorna o arco tangente de `x` (em radianos).'
math.atan['>5.3'] =
'Retorna o arco tangente de `y/x` (em radianos).'
math.atan2 =
'Retorna o arco tangente de `y/x` (em radianos).'
math.ceil =
'Retorna o menor valor inteiro maior ou igual a `x`.'
math.cos =
'Retorna o cosseno de `x` (requer valor em radianos).'
math.cosh =
'Retorna o cosseno hiperbólico de `x` (requer valor em radianos).'
math.deg =
'Converte o ângulo `x` de radianos para graus.'
math.exp =
'Retorna o valor `e^x` (onde `e` é a base do logaritmo natural).'
math.floor =
'Retorna o maior valor inteiro menor ou igual a `x`.'
math.fmod =
'Retorna o resto da divisão de `x` por `y` que arredonda o quociente para zero.'
math.frexp =
'Decompõe `x` em fatores e expoentes. Retorna `m` e `e` tal que `x = m * (2 ^ e)` é um inteiro e o valor absoluto de `m` está no intervalo [0,5, 1) (ou zero quando `x` é zero).'
math.huge =
'Um valor maior que qualquer outro valor numérico.'
math.ldexp =
'Retorna `m * (2 ^ e)`.'
math.log['<5.1'] =
'Retorna o logaritmo natural de `x`.'
math.log['>5.2'] =
'Retorna o logaritmo de `x` na base dada.'
math.log10 =
'Retorna o logaritmo `x` na base 10.'
math.max =
'Retorna o argumento com o valor máximo de acordo com o operador `<`.'
math.maxinteger['>5.3'] =
'Retorna o valor máximo para um inteiro.'
math.min =
'Retorna o argumento com o valor mínimo de acordo com o operador `<`.'
math.mininteger['>5.3'] =
'Retorna o valor mínimo para um inteiro.'
math.modf =
'Retorna a parte inteira e a parte fracionária de `x`.'
math.pi =
'O valor de *π*.'
math.pow =
'Retorna `x ^ y`.'
math.rad =
'Converte o ângulo `x` de graus para radianos.'
math.random =
[[
* `math.random()`: Retorna um valor real (i.e., ponto flutuante) no intervalo [0,1).
* `math.random(n)`: Retorna um inteiro no intervalo [1, n].
* `math.random(m, n)`: Retorna um inteiro no intervalo [m, n].
]]
math.randomseed['<5.3'] =
'Define `x` como valor semente (i.e., `seed`) para a função geradora de números pseudo-aleatória.'
math.randomseed['>5.4'] =
[[
* `math.randomseed(x, y)`: Concatena `x` e `y` em um espaço de 128-bits que é usado como valor semente (`seed`) para reinicializar o gerador de números pseudo-aleatório.
* `math.randomseed(x)`: Equivale a `math.randomseed(x, 0)` .
* `math.randomseed()`: Gera um valor semente (i.e., `seed`) com fraca probabilidade de aleatoriedade.
]]
math.sin =
'Retorna o seno de `x` (requer valor em radianos).'
math.sinh =
'Retorna o seno hiperbólico de `x` (requer valor em radianos).'
math.sqrt =
'Retorna a raiz quadrada de `x`.'
math.tan =
'Retorna a tangente de `x` (requer valor em radianos).'
math.tanh =
'Retorna a tangente hiperbólica de `x` (requer valor em radianos).'
math.tointeger['>5.3'] =
'Se o valor `x` pode ser convertido para um inteiro, retorna esse inteiro.'
math.type['>5.3'] =
'Retorna `"integer"` se `x` é um inteiro, `"float"` se for um valor real (i.e., ponto flutuante), ou `nil` se `x` não é um número.'
math.ult['>5.3'] =
'Retorna `true` se e somente se `m` é menor `n` quando eles são comparados como inteiros sem sinal.'
os =
''
os.clock =
'Retorna uma aproximação do valor, em segundos, do tempo de CPU usado pelo programa.'
os.date =
'Retorna uma string ou uma tabela contendo data e hora, formatada de acordo com a string `format` fornecida.'
os.difftime =
'Retorna a diferença, em segundos, do tempo `t1` para o tempo` t2`.'
os.execute =
'Passa `command` para ser executado por um `shell` do sistema operacional.'
os.exit['<5.1'] =
'Chama a função `exit` do C para encerrar o programa.'
os.exit['>5.2'] =
'Chama a função `exit` do ISO C para encerrar o programa.'
os.getenv =
'Retorna o valor da variável de ambiente de processo `varname`.'
os.remove =
'Remove o arquivo com o nome dado.'
os.rename =
'Renomeia o arquivo ou diretório chamado `oldname` para `newname`.'
os.setlocale =
'Define a localidade atual do programa.'
os.time =
'Retorna a hora atual quando chamada sem argumentos, ou um valor representando a data e a hora local especificados pela tabela fornecida.'
os.tmpname =
'Retorna uma string com um nome de arquivo que pode ser usado como arquivo temporário.'
osdate.year =
'Quatro dígitos.'
osdate.month =
'1-12'
osdate.day =
'1-31'
osdate.hour =
'0-23'
osdate.min =
'0-59'
osdate.sec =
'0-61'
osdate.wday =
'Dia da semana, 17, Domingo é 1'
osdate.yday =
'Dia do ano, 1366'
osdate.isdst =
'Bandeira para indicar horário de verão (i.e., `Daylight Saving Time`), um valor booleano.'
package =
''
require['<5.3'] =
'Carrega o módulo fornecido e retorna qualquer valor retornado pelo módulo (`true` quando `nil`).'
require['>5.4'] =
'Carrega o módulo fornecido e retorna qualquer valor retornado pelo pesquisador (`true` quando `nil`). Além desse valor, também retorna como segundo resultado um carregador de dados retornados pelo pesquisador, o que indica como `require` encontrou o módulo. (Por exemplo, se o módulo vier de um arquivo, este carregador de dados é o caminho do arquivo.)'
package.config =
'string descrevendo configurações a serem utilizadas durante a compilação de pacotes.'
package.cpath =
'O caminho usado pelo `require` para procurar pelo carregador C.'
package.loaded =
'Uma tabela usada pelo `require` para controlar quais módulos já estão carregados.'
package.loaders =
'Uma tabela usada pelo `require` para controlar como carregar módulos.'
package.loadlib =
'Dinamicamente vincula o programa no `host` com a biblioteca C `libname`.'
package.path =
'O caminho usado pelo `require` para procurar por um carregador Lua.'
package.preload =
'Uma tabela para armazenar carregadores de módulos específicos.'
package.searchers =
'Uma tabela usada pelo `require` para controlar como buscar módulos.'
package.searchpath =
'Procura por `name` em `path`.'
package.seeall =
'Define uma `metatable` `module` com o campo `__index` referenciando o ambiente global, para que este módulo herde valores do ambiente global. Para ser usado como uma opção a função `module`.'
string =
''
string.byte =
'Retorna os códigos numéricos internos dos caracteres `s[i], s[i+1], ..., s[j]`.'
string.char =
'Retorna uma string com comprimento igual ao número de argumentos, no qual cada caractere possui o código numérico interno igual ao seu argumento correspondente.'
string.dump =
'Retorna uma string contendo uma representação binária (i.e., *binary chunk*) da função dada.'
string.find =
'Procura a primeira correspondencia de `pattern` (veja §6.4.1) na string.'
string.format =
'Retorna uma versão formatada de seu número variável de argumentos após a descrição dada em seu primeiro argumento.'
string.gmatch =
[[
Retorna um iterator que, a cada vez que é chamado, retorna as próximas capturas de `pattern` (veja §6.4.1) sobre a string *s*.
Por exemplo, o loop a seguir irá iterar em todas as palavras da string *s*, imprimindo cada palavra por linha:
```lua
s =
"hello world from Lua"
for w in string.gmatch(s, "%a+") do
print(w)
end
```
]]
string.gsub =
'Retorna uma cópia da *s* em que todas ou, caso fornecido, as primeiras `n` ocorrências de `pattern` (veja §6.4.1) que tiverem sido substituídas por uma string de substituição especificada por `repl`.'
string.len =
'Retorna o comprimento da string.'
string.lower =
'Retorna uma cópia desta string com todas as letras maiúsculas alteradas para minúsculas.'
string.match =
'Procura a primeira ocorrência do `pattern` (veja §6.4.1) na string.'
string.pack =
'Retorna uma string binária contendo os valores `V1`, `v2`, etc. empacotados (isto é, serializado de forma binário) de acordo com o formato da string `fmt` fornecida (veja §6.4.2).'
string.packsize =
'Retorna o tamanho de uma string resultante de `string.pack` com o formato da string `fmt` fornecida (veja §6.4.2).'
string.rep['>5.2'] =
'Retorna uma string que é a concatenação de `n` cópias da string `s` separadas pela string `sep`.'
string.rep['<5.1'] =
'Retorna uma string que é a concatenação de `n` cópias da string `s`.'
string.reverse =
'Retorna uma string que representa a string `s` invertida.'
string.sub =
'Retorna a substring da string `s` que começa no índice `i` e continua até o índice `j`.'
string.unpack =
'Retorna os valores empacotados na string de acordo com o formato da string `fmt` fornecida (veja §6.4.2).'
string.upper =
'Retorna uma cópia desta string com todas as letras minúsculas alteradas para maiúsculas.'
table =
''
table.concat =
'Dada uma lista onde todos os elementos são strings ou números, retorna a string `list[i]..sep..list[i+1] ··· sep..list[j]`.'
table.insert =
'Insere o elemento `value` na posição `pos` de `list`.'
table.maxn =
'Retorna o maior índice numérico positivo da tabela fornecida ou zero se a tabela não tiver índices numéricos positivos.'
table.move =
[[
Move os elementos da tabela `a1` para tabela `a2`.
```lua
a2[t],··· =
a1[f],···,a1[e]
return a2
```
]]
table.pack =
'Retorna uma nova tabela com todos os argumentos armazenados em chaves `1`, `2`, etc. e com um campo `"n"` com o número total de argumentos.'
table.remove =
'Remove de `list` o elemento na posição `pos`, retornando o valor do elemento removido.'
table.sort =
'Ordena os elementos de `list` em uma determinada ordem, *in-place*, de `list[1]` para `list[#list]`.'
table.unpack =
[[
Retorna os elementos da lista fornecida. Esta função é equivalente a
```lua
return list[i], list[i+1], ···, list[j]
```
Por padrão, `i` é `1` e `j` é `#list`.
]]
table.foreach = -- TODO: need translate!
'Executes the given f over all elements of table. For each element, f is called with the index and respective value as arguments. If f returns a non-nil value, then the loop is broken, and this value is returned as the final value of foreach.'
table.foreachi = -- TODO: need translate!
'Executes the given f over the numerical indices of table. For each index, f is called with the index and respective value as arguments. Indices are visited in sequential order, from 1 to n, where n is the size of the table. If f returns a non-nil value, then the loop is broken and this value is returned as the result of foreachi.'
table.getn = -- TODO: need translate!
'Returns the number of elements in the table. This function is equivalent to `#list`.'
table.new = -- TODO: need translate!
[[This creates a pre-sized table, just like the C API equivalent `lua_createtable()`. This is useful for big tables if the final table size is known and automatic table resizing is too expensive. `narray` parameter specifies the number of array-like items, and `nhash` parameter specifies the number of hash-like items. The function needs to be required before use.
```lua
require("table.new")
```
]]
table.clear = -- TODO: need translate!
[[This clears all keys and values from a table, but preserves the allocated array/hash sizes. This is useful when a table, which is linked from multiple places, needs to be cleared and/or when recycling a table for use by the same context. This avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth. The function needs to be required before use.
```lua
require("table.clear").
```
Please note this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work.
]]
utf8 =
''
utf8.char =
'Recebe zero ou mais inteiros, converte cada um à sua sequência de byte UTF-8 correspondente e retorna uma string com a concatenação de todas essas sequências.'
utf8.charpattern =
'O padrão que corresponde exatamente uma sequência de byte UTF-8, supondo que seja uma sequência válida UTF-8.'
utf8.codes =
[[
Retorna valores tal que a seguinte construção
```lua
for p, c in utf8.codes(s) do
body
end
```
itere em todos os caracteres UTF-8 na string s, com p sendo a posição (em bytes) e c o *codepoint* de cada caractere. Ele gera um erro se encontrado qualquer sequência de byte inválida.
]]
utf8.codepoint =
'Retorna os *codepoints* (em inteiros) de todos os caracteres em `s` que iniciam entre as posições do byte `i` e `j` (ambos inclusos).'
utf8.len =
'Retorna o número de caracteres UTF-8 na string `s` que começa entre as posições `i` e `j` (ambos inclusos).'
utf8.offset =
'Retorna a posição (em bytes) onde a codificação do `n`-ésimo caractere de `s` inícia (contando a partir da posição `i`).'

View file

@ -0,0 +1,436 @@
---@diagnostic disable: undefined-global
config.addonManager.enable = -- TODO: need translate!
"Whether the addon manager is enabled or not."
config.runtime.version = -- TODO: need translate!
"Lua runtime version."
config.runtime.path = -- TODO: need translate!
[[
When using `require`, how to find the file based on the input name.
Setting this config to `?/init.lua` means that when you enter `require 'myfile'`, `${workspace}/myfile/init.lua` will be searched from the loaded files.
if `runtime.pathStrict` is `false`, `${workspace}/**/myfile/init.lua` will also be searched.
If you want to load files outside the workspace, you need to set `Lua.workspace.library` first.
]]
config.runtime.pathStrict = -- TODO: need translate!
'When enabled, `runtime.path` will only search the first level of directories, see the description of `runtime.path`.'
config.runtime.special = -- TODO: need translate!
[[The custom global variables are regarded as some special built-in variables, and the language server will provide special support
The following example shows that 'include' is treated as' require '.
```json
"Lua.runtime.special" : {
"include" : "require"
}
```
]]
config.runtime.unicodeName = -- TODO: need translate!
"Allows Unicode characters in name."
config.runtime.nonstandardSymbol = -- TODO: need translate!
"Supports non-standard symbols. Make sure that your runtime environment supports these symbols."
config.runtime.plugin = -- TODO: need translate!
"Plugin path. Please read [wiki](https://luals.github.io/wiki/plugins) to learn more."
config.runtime.pluginArgs = -- TODO: need translate!
"Additional arguments for the plugin."
config.runtime.fileEncoding = -- TODO: need translate!
"File encoding. The `ansi` option is only available under the `Windows` platform."
config.runtime.builtin = -- TODO: need translate!
[[
Adjust the enabled state of the built-in library. You can disable (or redefine) the non-existent library according to the actual runtime environment.
* `default`: Indicates that the library will be enabled or disabled according to the runtime version
* `enable`: always enable
* `disable`: always disable
]]
config.runtime.meta = -- TODO: need translate!
'Format of the directory name of the meta files.'
config.diagnostics.enable = -- TODO: need translate!
"Enable diagnostics."
config.diagnostics.disable = -- TODO: need translate!
"Disabled diagnostic (Use code in hover brackets)."
config.diagnostics.globals = -- TODO: need translate!
"Defined global variables."
config.diagnostics.severity = -- TODO: need translate!
[[
Modify the diagnostic severity.
End with `!` means override the group setting `diagnostics.groupSeverity`.
]]
config.diagnostics.neededFileStatus = -- TODO: need translate!
[[
* Opened: only diagnose opened files
* Any: diagnose all files
* None: disable this diagnostic
End with `!` means override the group setting `diagnostics.groupFileStatus`.
]]
config.diagnostics.groupSeverity = -- TODO: need translate!
[[
Modify the diagnostic severity in a group.
`Fallback` means that diagnostics in this group are controlled by `diagnostics.severity` separately.
Other settings will override individual settings without end of `!`.
]]
config.diagnostics.groupFileStatus = -- TODO: need translate!
[[
Modify the diagnostic needed file status in a group.
* Opened: only diagnose opened files
* Any: diagnose all files
* None: disable this diagnostic
`Fallback` means that diagnostics in this group are controlled by `diagnostics.neededFileStatus` separately.
Other settings will override individual settings without end of `!`.
]]
config.diagnostics.workspaceEvent = -- TODO: need translate!
"Set the time to trigger workspace diagnostics."
config.diagnostics.workspaceEvent.OnChange = -- TODO: need translate!
"Trigger workspace diagnostics when the file is changed."
config.diagnostics.workspaceEvent.OnSave = -- TODO: need translate!
"Trigger workspace diagnostics when the file is saved."
config.diagnostics.workspaceEvent.None = -- TODO: need translate!
"Disable workspace diagnostics."
config.diagnostics.workspaceDelay = -- TODO: need translate!
"Latency (milliseconds) for workspace diagnostics."
config.diagnostics.workspaceRate = -- TODO: need translate!
"Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage, but also reduces the speed of workspace diagnostics. The diagnosis of the file you are currently editing is always done at full speed and is not affected by this setting."
config.diagnostics.libraryFiles = -- TODO: need translate!
"How to diagnose files loaded via `Lua.workspace.library`."
config.diagnostics.libraryFiles.Enable = -- TODO: need translate!
"Always diagnose these files."
config.diagnostics.libraryFiles.Opened = -- TODO: need translate!
"Only when these files are opened will it be diagnosed."
config.diagnostics.libraryFiles.Disable = -- TODO: need translate!
"These files are not diagnosed."
config.diagnostics.ignoredFiles = -- TODO: need translate!
"How to diagnose ignored files."
config.diagnostics.ignoredFiles.Enable = -- TODO: need translate!
"Always diagnose these files."
config.diagnostics.ignoredFiles.Opened = -- TODO: need translate!
"Only when these files are opened will it be diagnosed."
config.diagnostics.ignoredFiles.Disable = -- TODO: need translate!
"These files are not diagnosed."
config.diagnostics.disableScheme = -- TODO: need translate!
'Do not diagnose Lua files that use the following scheme.'
config.diagnostics.unusedLocalExclude = -- TODO: need translate!
'Do not diagnose `unused-local` when the variable name matches the following pattern.'
config.workspace.ignoreDir = -- TODO: need translate!
"Ignored files and directories (Use `.gitignore` grammar)."-- .. example.ignoreDir,
config.workspace.ignoreSubmodules = -- TODO: need translate!
"Ignore submodules."
config.workspace.useGitIgnore = -- TODO: need translate!
"Ignore files list in `.gitignore` ."
config.workspace.maxPreload = -- TODO: need translate!
"Max preloaded files."
config.workspace.preloadFileSize = -- TODO: need translate!
"Skip files larger than this value (KB) when preloading."
config.workspace.library = -- TODO: need translate!
"In addition to the current workspace, which directories will load files from. The files in these directories will be treated as externally provided code libraries, and some features (such as renaming fields) will not modify these files."
config.workspace.checkThirdParty = -- TODO: need translate!
[[
Automatic detection and adaptation of third-party libraries, currently supported libraries are:
* OpenResty
* Cocos4.0
* LÖVE
* LÖVR
* skynet
* Jass
]]
config.workspace.userThirdParty = -- TODO: need translate!
'Add private third-party library configuration file paths here, please refer to the built-in [configuration file path](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)'
config.workspace.supportScheme = -- TODO: need translate!
'Provide language server for the Lua files of the following scheme.'
config.completion.enable = -- TODO: need translate!
'Enable completion.'
config.completion.callSnippet = -- TODO: need translate!
'Shows function call snippets.'
config.completion.callSnippet.Disable = -- TODO: need translate!
"Only shows `function name`."
config.completion.callSnippet.Both = -- TODO: need translate!
"Shows `function name` and `call snippet`."
config.completion.callSnippet.Replace = -- TODO: need translate!
"Only shows `call snippet.`"
config.completion.keywordSnippet = -- TODO: need translate!
'Shows keyword syntax snippets.'
config.completion.keywordSnippet.Disable = -- TODO: need translate!
"Only shows `keyword`."
config.completion.keywordSnippet.Both = -- TODO: need translate!
"Shows `keyword` and `syntax snippet`."
config.completion.keywordSnippet.Replace = -- TODO: need translate!
"Only shows `syntax snippet`."
config.completion.displayContext = -- TODO: need translate!
"Previewing the relevant code snippet of the suggestion may help you understand the usage of the suggestion. The number set indicates the number of intercepted lines in the code fragment. If it is set to `0`, this feature can be disabled."
config.completion.workspaceWord = -- TODO: need translate!
"Whether the displayed context word contains the content of other files in the workspace."
config.completion.showWord = -- TODO: need translate!
"Show contextual words in suggestions."
config.completion.showWord.Enable = -- TODO: need translate!
"Always show context words in suggestions."
config.completion.showWord.Fallback = -- TODO: need translate!
"Contextual words are only displayed when suggestions based on semantics cannot be provided."
config.completion.showWord.Disable = -- TODO: need translate!
"Do not display context words."
config.completion.autoRequire = -- TODO: need translate!
"When the input looks like a file name, automatically `require` this file."
config.completion.showParams = -- TODO: need translate!
"Display parameters in completion list. When the function has multiple definitions, they will be displayed separately."
config.completion.requireSeparator = -- TODO: need translate!
"The separator used when `require`."
config.completion.postfix = -- TODO: need translate!
"The symbol used to trigger the postfix suggestion."
config.color.mode = -- TODO: need translate!
"Color mode."
config.color.mode.Semantic = -- TODO: need translate!
"Semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect."
config.color.mode.SemanticEnhanced = -- TODO: need translate!
"Enhanced semantic color. Like `Semantic`, but with additional analysis which might be more computationally expensive."
config.color.mode.Grammar = -- TODO: need translate!
"Grammar color."
config.semantic.enable = -- TODO: need translate!
"Enable semantic color. You may need to set `editor.semanticHighlighting.enabled` to `true` to take effect."
config.semantic.variable = -- TODO: need translate!
"Semantic coloring of variables/fields/parameters."
config.semantic.annotation = -- TODO: need translate!
"Semantic coloring of type annotations."
config.semantic.keyword = -- TODO: need translate!
"Semantic coloring of keywords/literals/operators. You only need to enable this feature if your editor cannot do syntax coloring."
config.signatureHelp.enable = -- TODO: need translate!
"Enable signature help."
config.hover.enable = -- TODO: need translate!
"Enable hover."
config.hover.viewString = -- TODO: need translate!
"Hover to view the contents of a string (only if the literal contains an escape character)."
config.hover.viewStringMax = -- TODO: need translate!
"The maximum length of a hover to view the contents of a string."
config.hover.viewNumber = -- TODO: need translate!
"Hover to view numeric content (only if literal is not decimal)."
config.hover.fieldInfer = -- TODO: need translate!
"When hovering to view a table, type infer will be performed for each field. When the accumulated time of type infer reaches the set value (MS), the type infer of subsequent fields will be skipped."
config.hover.previewFields = -- TODO: need translate!
"When hovering to view a table, limits the maximum number of previews for fields."
config.hover.enumsLimit = -- TODO: need translate!
"When the value corresponds to multiple types, limit the number of types displaying."
config.hover.expandAlias = -- TODO: need translate!
[[
Whether to expand the alias. For example, expands `---@alias myType boolean|number` appears as `boolean|number`, otherwise it appears as `myType'.
]]
config.develop.enable = -- TODO: need translate!
'Developer mode. Do not enable, performance will be affected.'
config.develop.debuggerPort = -- TODO: need translate!
'Listen port of debugger.'
config.develop.debuggerWait = -- TODO: need translate!
'Suspend before debugger connects.'
config.intelliSense.searchDepth = -- TODO: need translate!
'Set the search depth for IntelliSense. Increasing this value increases accuracy, but decreases performance. Different workspace have different tolerance for this setting. Please adjust it to the appropriate value.'
config.intelliSense.fastGlobal = -- TODO: need translate!
'In the global variable completion, and view `_G` suspension prompt. This will slightly reduce the accuracy of type speculation, but it will have a significant performance improvement for projects that use a lot of global variables.'
config.window.statusBar = -- TODO: need translate!
'Show extension status in status bar.'
config.window.progressBar = -- TODO: need translate!
'Show progress bar in status bar.'
config.hint.enable = -- TODO: need translate!
'Enable inlay hint.'
config.hint.paramType = -- TODO: need translate!
'Show type hints at the parameter of the function.'
config.hint.setType = -- TODO: need translate!
'Show hints of type at assignment operation.'
config.hint.paramName = -- TODO: need translate!
'Show hints of parameter name at the function call.'
config.hint.paramName.All = -- TODO: need translate!
'All types of parameters are shown.'
config.hint.paramName.Literal = -- TODO: need translate!
'Only literal type parameters are shown.'
config.hint.paramName.Disable = -- TODO: need translate!
'Disable parameter hints.'
config.hint.arrayIndex = -- TODO: need translate!
'Show hints of array index when constructing a table.'
config.hint.arrayIndex.Enable = -- TODO: need translate!
'Show hints in all tables.'
config.hint.arrayIndex.Auto = -- TODO: need translate!
'Show hints only when the table is greater than 3 items, or the table is a mixed table.'
config.hint.arrayIndex.Disable = -- TODO: need translate!
'Disable hints of array index.'
config.hint.await = -- TODO: need translate!
'If the called function is marked `---@async`, prompt `await` at the call.'
config.hint.semicolon = -- TODO: need translate!
'If there is no semicolon at the end of the statement, display a virtual semicolon.'
config.hint.semicolon.All = -- TODO: need translate!
'All statements display virtual semicolons.'
config.hint.semicolon.SameLine = -- TODO: need translate!
'When two statements are on the same line, display a semicolon between them.'
config.hint.semicolon.Disable = -- TODO: need translate!
'Disable virtual semicolons.'
config.codeLens.enable = -- TODO: need translate!
'Enable code lens.'
config.format.enable = -- TODO: need translate!
'Enable code formatter.'
config.format.defaultConfig = -- TODO: need translate!
[[
The default format configuration. Has a lower priority than `.editorconfig` file in the workspace.
Read [formatter docs](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs) to learn usage.
]]
config.spell.dict = -- TODO: need translate!
'Custom words for spell checking.'
config.nameStyle.config = -- TODO: need translate!
'Set name style config'
config.telemetry.enable = -- TODO: need translate!
[[
Enable telemetry to send your editor information and error logs over the network. Read our privacy policy [here](https://luals.github.io/privacy/#language-server).
]]
config.misc.parameters = -- TODO: need translate!
'[Command line parameters](https://github.com/LuaLS/lua-telemetry-server/tree/master/method) when starting the language service in VSCode.'
config.misc.executablePath = -- TODO: need translate!
'Specify the executable path in VSCode.'
config.type.castNumberToInteger = -- TODO: need translate!
'Allowed to assign the `number` type to the `integer` type.'
config.type.weakUnionCheck = -- TODO: need translate!
[[
Once one subtype of a union type meets the condition, the union type also meets the condition.
When this setting is `false`, the `number|boolean` type cannot be assigned to the `number` type. It can be with `true`.
]]
config.type.weakNilCheck = -- TODO: need translate!
[[
When checking the type of union type, ignore the `nil` in it.
When this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.
]]
config.doc.privateName = -- TODO: need translate!
'Treat specific field names as private, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are private, witch can only be accessed in the class where the definition is located.'
config.doc.protectedName = -- TODO: need translate!
'Treat specific field names as protected, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are protected, witch can only be accessed in the class where the definition is located and its subclasses.'
config.doc.packageName = -- TODO: need translate!
'Treat specific field names as package, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are package, witch can only be accessed in the file where the definition is located.'
config.diagnostics['unused-local'] = -- TODO: need translate!
'未使用的局部变量'
config.diagnostics['unused-function'] = -- TODO: need translate!
'未使用的函数'
config.diagnostics['undefined-global'] = -- TODO: need translate!
'未定义的全局变量'
config.diagnostics['global-in-nil-env'] = -- TODO: need translate!
'不能使用全局变量( `_ENV` 被设置为了 `nil`'
config.diagnostics['unused-label'] = -- TODO: need translate!
'未使用的标签'
config.diagnostics['unused-vararg'] = -- TODO: need translate!
'未使用的不定参数'
config.diagnostics['trailing-space'] = -- TODO: need translate!
'后置空格'
config.diagnostics['redefined-local'] = -- TODO: need translate!
'重复定义的局部变量'
config.diagnostics['newline-call'] = -- TODO: need translate!
'以 `(` 开始的新行,在语法上被解析为了上一行的函数调用'
config.diagnostics['newfield-call'] = -- TODO: need translate!
'在字面量表中2行代码之间缺少分隔符在语法上被解析为了一次索引操作'
config.diagnostics['redundant-parameter'] = -- TODO: need translate!
'函数调用时,传入了多余的参数'
config.diagnostics['ambiguity-1'] = -- TODO: need translate!
'优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` '
config.diagnostics['lowercase-global'] = -- TODO: need translate!
'首字母小写的全局变量定义'
config.diagnostics['undefined-env-child'] = -- TODO: need translate!
'`_ENV` 被设置为了新的字面量表,但是试图获取的全局变量不再这张表中'
config.diagnostics['duplicate-index'] = -- TODO: need translate!
'在字面量表中重复定义了索引'
config.diagnostics['empty-block'] = -- TODO: need translate!
'空代码块'
config.diagnostics['redundant-value'] = -- TODO: need translate!
'赋值操作时,值的数量比被赋值的对象多'
config.diagnostics['assign-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for assignments in which the value\'s type does not match the type of the assigned variable.'
config.diagnostics['await-in-sync'] = -- TODO: need translate!
'Enable diagnostics for calls of asynchronous functions within a synchronous function.'
config.diagnostics['cast-local-type'] = -- TODO: need translate!
'Enable diagnostics for casts of local variables where the target type does not match the defined type.'
config.diagnostics['cast-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for casts where the target type does not match the initial type.'
config.diagnostics['circular-doc-class'] = -- TODO: need translate!
'Enable diagnostics for two classes inheriting from each other introducing a circular relation.'
config.diagnostics['close-non-object'] = -- TODO: need translate!
'Enable diagnostics for attempts to close a variable with a non-object.'
config.diagnostics['code-after-break'] = -- TODO: need translate!
'Enable diagnostics for code placed after a break statement in a loop.'
config.diagnostics['codestyle-check'] = -- TODO: need translate!
'Enable diagnostics for incorrectly styled lines.'
config.diagnostics['count-down-loop'] = -- TODO: need translate!
'Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing.'
config.diagnostics['deprecated'] = -- TODO: need translate!
'Enable diagnostics to highlight deprecated API.'
config.diagnostics['different-requires'] = -- TODO: need translate!
'Enable diagnostics for files which are required by two different paths.'
config.diagnostics['discard-returns'] = -- TODO: need translate!
'Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored.'
config.diagnostics['doc-field-no-class'] = -- TODO: need translate!
'Enable diagnostics to highlight a field annotation without a defining class annotation.'
config.diagnostics['duplicate-doc-alias'] = -- TODO: need translate!
'Enable diagnostics for a duplicated alias annotation name.'
config.diagnostics['duplicate-doc-field'] = -- TODO: need translate!
'Enable diagnostics for a duplicated field annotation name.'
config.diagnostics['duplicate-doc-param'] = -- TODO: need translate!
'Enable diagnostics for a duplicated param annotation name.'
config.diagnostics['duplicate-set-field'] = -- TODO: need translate!
'Enable diagnostics for setting the same field in a class more than once.'
config.diagnostics['incomplete-signature-doc'] = -- TODO: need translate!
'Incomplete @param or @return annotations for functions.'
config.diagnostics['invisible'] = -- TODO: need translate!
'Enable diagnostics for accesses to fields which are invisible.'
config.diagnostics['missing-global-doc'] = -- TODO: need translate!
'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.'
config.diagnostics['missing-local-export-doc'] = -- TODO: need translate!
'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.'
config.diagnostics['missing-parameter'] = -- TODO: need translate!
'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.'
config.diagnostics['missing-return'] = -- TODO: need translate!
'Enable diagnostics for functions with return annotations which have no return statement.'
config.diagnostics['missing-return-value'] = -- TODO: need translate!
'Enable diagnostics for return statements without values although the containing function declares returns.'
config.diagnostics['need-check-nil'] = -- TODO: need translate!
'Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.'
config.diagnostics['no-unknown'] = -- TODO: need translate!
'Enable diagnostics for cases in which the type cannot be inferred.'
config.diagnostics['not-yieldable'] = -- TODO: need translate!
'Enable diagnostics for calls to `coroutine.yield()` when it is not permitted.'
config.diagnostics['param-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition.'
config.diagnostics['redundant-return'] = -- TODO: need translate!
'Enable diagnostics for return statements which are not needed because the function would exit on its own.'
config.diagnostics['redundant-return-value']= -- TODO: need translate!
'Enable diagnostics for return statements which return an extra value which is not specified by a return annotation.'
config.diagnostics['return-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
config.diagnostics['spell-check'] = -- TODO: need translate!
'Enable diagnostics for typos in strings.'
config.diagnostics['name-style-check'] = -- TODO: need translate!
'Enable diagnostics for name style.'
config.diagnostics['unbalanced-assignments']= -- TODO: need translate!
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
config.diagnostics['undefined-doc-class'] = -- TODO: need translate!
'Enable diagnostics for class annotations in which an undefined class is referenced.'
config.diagnostics['undefined-doc-name'] = -- TODO: need translate!
'Enable diagnostics for type annotations referencing an undefined type or alias.'
config.diagnostics['undefined-doc-param'] = -- TODO: need translate!
'Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition.'
config.diagnostics['undefined-field'] = -- TODO: need translate!
'Enable diagnostics for cases in which an undefined field of a variable is read.'
config.diagnostics['unknown-cast-variable'] = -- TODO: need translate!
'Enable diagnostics for casts of undefined variables.'
config.diagnostics['unknown-diag-code'] = -- TODO: need translate!
'Enable diagnostics in cases in which an unknown diagnostics code is entered.'
config.diagnostics['unknown-operator'] = -- TODO: need translate!
'Enable diagnostics for unknown operators.'
config.diagnostics['unreachable-code'] = -- TODO: need translate!
'Enable diagnostics for unreachable code.'
config.diagnostics['global-element'] = -- TODO: need translate!
'Enable diagnostics to warn about global elements.'
config.typeFormat.config = -- TODO: need translate!
'Configures the formatting behavior while typing Lua code.'
config.typeFormat.config.auto_complete_end = -- TODO: need translate!
'Controls if `end` is automatically completed at suitable positions.'
config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate!
'Controls if a separator is automatically appended at the end of a table declaration.'
config.typeFormat.config.format_line = -- TODO: need translate!
'Controls if a line is formatted at all.'
command.exportDocument = -- TODO: need translate!
'Lua: Export Document ...'
command.addon_manager.open = -- TODO: need translate!
'Lua: Open Addon Manager ...'
command.reloadFFIMeta = -- TODO: need translate!
'Lua: Reload luajit ffi meta'

View file

@ -0,0 +1,742 @@
---@diagnostic disable: undefined-global, lowercase-global
arg =
'独立版Lua的启动参数。'
assert =
'如果其参数 `v` 的值为假(`nil` 或 `false` 它就调用 $error 否则,返回所有的参数。 在错误情况时, `message` 指那个错误对象; 如果不提供这个参数,参数默认为 `"assertion failed!"` 。'
cgopt.collect =
'做一次完整的垃圾收集循环。'
cgopt.stop =
'停止垃圾收集器的运行。'
cgopt.restart =
'重启垃圾收集器的自动运行。'
cgopt.count =
'以 K 字节数为单位返回 Lua 使用的总内存数。'
cgopt.step =
'单步运行垃圾收集器。 步长“大小”由 `arg` 控制。'
cgopt.setpause =
'将 `arg` 设为收集器的 *间歇率* 。'
cgopt.setstepmul =
'将 `arg` 设为收集器的 *步进倍率* 。'
cgopt.incremental =
'改变收集器模式为增量模式。'
cgopt.generational =
'改变收集器模式为分代模式。'
cgopt.isrunning =
'返回表示收集器是否在工作的布尔值。'
collectgarbage =
'这个函数是垃圾收集器的通用接口。 通过参数 opt 它提供了一组不同的功能。'
dofile =
'打开该名字的文件,并执行文件中的 Lua 代码块。 不带参数调用时, `dofile` 执行标准输入的内容(`stdin`)。 返回该代码块的所有返回值。 对于有错误的情况,`dofile` 将错误反馈给调用者 (即,`dofile` 没有运行在保护模式下)。'
error =
[[
`message` `error`
`message` `error` level
]]
_G =
'一个全局变量(非函数), 内部储存有全局环境(参见 §2.2)。 Lua 自己不使用这个变量; 改变这个变量的值不会对任何环境造成影响,反之亦然。'
getfenv =
'返回给定函数的环境。`f` 可以是一个Lua函数也可是一个表示调用栈层级的数字。'
getmetatable =
'如果 `object` 不包含元表,返回 `nil` 。 否则,如果在该对象的元表中有 `"__metatable"` 域时返回其关联值, 没有时返回该对象的元表。'
ipairs =
[[
`t` `0`
```lua
for i,v in ipairs(t) do body end
```
`1,t[1]) (2,t[2]) ...`
]]
loadmode.b =
'只能是二进制代码块。'
loadmode.t =
'只能是文本代码块。'
loadmode.bt =
'可以是二进制也可以是文本。'
load['<5.1'] =
'使用 `func` 分段加载代码块。 每次调用 `func` 必须返回一个字符串用于连接前文。'
load['>5.2'] =
[[
`chunk` `chunk` `load` `chunk` `nil`
]]
loadfile =
'从文件 `filename` 或标准输入(如果文件名未提供)中获取代码块。'
loadstring =
'使用给定字符串加载代码块。'
module =
'创建一个模块。'
next =
[[
`next` `nil` `next` `nil` `next` `nil` `nil` `next(t)`
使 使 `for`
`next`
]]
pairs =
[[
`t` `__pairs` `t`
`next` `t` `nil`
```lua
for k,v in pairs(t) do body end
```
`t`
$next
]]
pcall =
'传入参数,以 *保护模式* 调用函数 `f` 。 这意味着 `f` 中的任何错误不会抛出; 取而代之的是,`pcall` 会将错误捕获到,并返回一个状态码。 第一个返回值是状态码(一个布尔量), 当没有错误时,其为真。 此时,`pcall` 同样会在状态码后返回所有调用的结果。 在有错误时,`pcall` 返回 `false` 加错误消息。'
print =
'接收任意数量的参数,并将它们的值打印到 `stdout`。 它用 `tostring` 函数将每个参数都转换为字符串。 `print` 不用于做格式化输出。仅作为看一下某个值的快捷方式。 多用于调试。 完整的对输出的控制,请使用 $string.format 以及 $io.write。'
rawequal =
'在不触发任何元方法的情况下 检查 `v1` 是否和 `v2` 相等。 返回一个布尔量。'
rawget =
'在不触发任何元方法的情况下 获取 `table[index]` 的值。 `table` 必须是一张表; `index` 可以是任何值。'
rawlen =
'在不触发任何元方法的情况下 返回对象 `v` 的长度。 `v` 可以是表或字符串。 它返回一个整数。'
rawset =
[[
`table[index]` `value` `table` `index` `nil` `NaN` `value` Lua
`table`
]]
select =
'如果 `index` 是个数字, 那么返回参数中第 `index` 个之后的部分; 负的数字会从后向前索引(`-1` 指最后一个参数)。 否则,`index` 必须是字符串 `"#"` 此时 `select` 返回参数的个数。'
setfenv =
'设置给定函数的环境。'
setmetatable =
[[
Lua C `metatable` `nil` `"__metatable"`
]]
tonumber =
[[
`base` `tonumber` `tonumber` `nil`
Lua §3.1
]]
tostring =
[[
使 $string.format
`v` `"__tostring"` `tostring` `v`
]]
type =
[[
`"nil"` `nil` `"number"` `"string"` `"boolean"` `"table"` `"function"` `"thread"` `"userdata"`
]]
_VERSION =
'一个包含有当前解释器版本号的全局变量(并非函数)。'
warn =
'使用所有参数组成的字符串消息来发送警告。'
xpcall['=5.1'] =
'传入参数,以 *保护模式* 调用函数 `f` 。这个函数和 `pcall` 类似。 不过它可以额外设置一个消息处理器 `err`。'
xpcall['>5.2'] =
'传入参数,以 *保护模式* 调用函数 `f` 。这个函数和 `pcall` 类似。 不过它可以额外设置一个消息处理器 `msgh`。'
unpack =
[[
`list`
```lua
return list[i], list[i+1], ···, list[j]
```
]]
bit32 =
''
bit32.arshift =
[[
`x` `disp` `disp` 使 `x` 使 `0`
]]
bit32.band =
'返回参数按位与的结果。'
bit32.bnot =
[[
`x`
```lua
assert(bit32.bnot(x) ==
(-1 - x) % 2^32)
```
]]
bit32.bor =
'返回参数按位或的结果。'
bit32.btest =
'参数按位与的结果不为0时返回 `true` 。'
bit32.bxor =
'返回参数按位异或的结果。'
bit32.extract =
'返回 `n` 中第 `field` 到第 `field + width - 1` 位组成的结果。'
bit32.replace =
'返回 `v` 的第 `field` 到第 `field + width - 1` 位替换 `n` 的对应位后的结果。'
bit32.lrotate =
'返回 `x` 向左旋转 `disp` 位的结果。`disp` 为负时向右旋转。'
bit32.lshift =
[[
`x` `disp` `disp` 使 `0`
```lua
assert(bit32.lshift(b, disp) ==
(b * 2^disp) % 2^32)
```
]]
bit32.rrotate =
'返回 `x` 向右旋转 `disp` 位的结果。`disp` 为负时向左旋转。'
bit32.rshift =
[[
`x` `disp` `disp` 使 `0`
```lua
assert(bit32.lshift(b, disp) ==
(b * 2^disp) % 2^32)
```
]]
coroutine =
''
coroutine.create =
'创建一个主体函数为 `f` 的新协程。 f 必须是一个 Lua 的函数。 返回这个新协程,它是一个类型为 `"thread"` 的对象。'
coroutine.isyieldable =
'如果正在运行的协程可以让出,则返回真。'
coroutine.isyieldable['>5.4'] =
'如果协程 `co` 可以让出,则返回真。`co` 默认为正在运行的协程。'
coroutine.close =
'关闭协程 `co`,并关闭它所有等待 *to-be-closed* 的变量,并将协程状态设为 `dead` 。'
coroutine.resume =
'开始或继续协程 `co` 的运行。'
coroutine.running =
'返回当前正在运行的协程加一个布尔量。 如果当前运行的协程是主线程,其为真。'
coroutine.status =
'以字符串形式返回协程 `co` 的状态。'
coroutine.wrap =
'创建一个主体函数为 `f` 的新协程。 f 必须是一个 Lua 的函数。 返回一个函数, 每次调用该函数都会延续该协程。'
coroutine.yield =
'挂起正在调用的协程的执行。'
costatus.running =
'正在运行。'
costatus.suspended =
'挂起或是还没有开始运行。'
costatus.normal =
'是活动的,但并不在运行。'
costatus.dead =
'运行完主体函数或因错误停止。'
debug =
''
debug.debug =
'进入一个用户交互模式,运行用户输入的每个字符串。'
debug.getfenv =
'返回对象 `o` 的环境。'
debug.gethook =
'返回三个表示线程钩子设置的值: 当前钩子函数,当前钩子掩码,当前钩子计数 。'
debug.getinfo =
'返回关于一个函数信息的表。'
debug.getlocal['<5.1'] =
'返回在栈的 `level` 层处函数的索引为 `index` 的局部变量的名字和值。'
debug.getlocal['>5.2'] =
'返回在栈的 `f` 层处函数的索引为 `index` 的局部变量的名字和值。'
debug.getmetatable =
'返回给定 `value` 的元表。'
debug.getregistry =
'返回注册表。'
debug.getupvalue =
'返回函数 `f` 的第 `up` 个上值的名字和值。'
debug.getuservalue['<5.3']=
'返回关联在 `u` 上的 `Lua` 值。'
debug.getuservalue['>5.4']=
'返回关联在 `u` 上的第 `n` 个 `Lua` 值,以及一个布尔,`false`表示值不存在。'
debug.setcstacklimit =
[[
### ** `Lua 5.4.2` **
C栈限制Lua中嵌套调用的深度
`false`
]]
debug.setfenv =
'将 `table` 设置为 `object` 的环境。'
debug.sethook =
'将一个函数作为钩子函数设入。'
debug.setlocal =
'将 `value` 赋给 栈上第 `level` 层函数的第 `local` 个局部变量。'
debug.setmetatable =
'将 `value` 的元表设为 `table` (可以是 `nil`)。'
debug.setupvalue =
'将 `value` 设为函数 `f` 的第 `up` 个上值。'
debug.setuservalue['<5.3']=
'将 `value` 设为 `udata` 的关联值。'
debug.setuservalue['>5.4']=
'将 `value` 设为 `udata` 的第 `n` 个关联值。'
debug.traceback =
'返回调用栈的栈回溯信息。 字符串可选项 `message` 被添加在栈回溯信息的开头。'
debug.upvalueid =
'返回指定函数第 `n` 个上值的唯一标识符(一个轻量用户数据)。'
debug.upvaluejoin =
'让 Lua 闭包 `f1` 的第 `n1` 个上值 引用 `Lua` 闭包 `f2` 的第 `n2` 个上值。'
infowhat.n =
'`name` 和 `namewhat`'
infowhat.S =
'`source``short_src``linedefined``lalinedefined`,和 `what`'
infowhat.l =
'`currentline`'
infowhat.t =
'`istailcall`'
infowhat.u['<5.1'] =
'`nups`'
infowhat.u['>5.2'] =
'`nups`、`nparams` 和 `isvararg`'
infowhat.f =
'`func`'
infowhat.r =
'`ftransfer` 和 `ntransfer`'
infowhat.L =
'`activelines`'
hookmask.c =
'每当 Lua 调用一个函数时,调用钩子。'
hookmask.r =
'每当 Lua 从一个函数内返回时,调用钩子。'
hookmask.l =
'每当 Lua 进入新的一行时,调用钩子。'
file =
''
file[':close'] =
'关闭 `file`。'
file[':flush'] =
'将写入的数据保存到 `file` 中。'
file[':lines'] =
[[
------
```lua
for c in file:lines(...) do
body
end
```
]]
file[':read'] =
'读文件 `file` 指定的格式决定了要读什么。'
file[':seek'] =
'设置及获取基于文件开头处计算出的位置。'
file[':setvbuf'] =
'设置输出文件的缓冲模式。'
file[':write'] =
'将参数的值逐个写入 `file`。'
readmode.n =
'读取一个数字,根据 Lua 的转换文法返回浮点数或整数。'
readmode.a =
'从当前位置开始读取整个文件。'
readmode.l =
'读取一行并忽略行结束标记。'
readmode.L =
'读取一行并保留行结束标记。'
seekwhence.set =
'基点为 0 (文件开头)。'
seekwhence.cur =
'基点为当前位置。'
seekwhence['.end'] =
'基点为文件尾。'
vbuf.no =
'不缓冲;输出操作立刻生效。'
vbuf.full =
'完全缓冲;只有在缓存满或调用 flush 时才做输出操作。'
vbuf.line =
'行缓冲;输出将缓冲到每次换行前。'
io =
''
io.stdin =
'标准输入。'
io.stdout =
'标准输出。'
io.stderr =
'标准错误。'
io.close =
'关闭 `file` 或默认输出文件。'
io.flush =
'将写入的数据保存到默认输出文件中。'
io.input =
'设置 `file` 为默认输入文件。'
io.lines =
[[
------
```lua
for c in io.lines(filename, ...) do
body
end
```
]]
io.open =
'用字符串 `mode` 指定的模式打开一个文件。'
io.output =
'设置 `file` 为默认输出文件。'
io.popen =
'用一个分离进程开启程序 `prog` 。'
io.read =
'读文件 `file` 指定的格式决定了要读什么。'
io.tmpfile =
'如果成功,返回一个临时文件的句柄。'
io.type =
'检查 `obj` 是否是合法的文件句柄。'
io.write =
'将参数的值逐个写入默认输出文件。'
openmode.r =
'读模式。'
openmode.w =
'写模式。'
openmode.a =
'追加模式。'
openmode['.r+'] =
'更新模式,所有之前的数据都保留。'
openmode['.w+'] =
'更新模式,所有之前的数据都删除。'
openmode['.a+'] =
'追加更新模式,所有之前的数据都保留,只允许在文件尾部做写入。'
openmode.rb =
'读模式。(二进制方式)'
openmode.wb =
'写模式。(二进制方式)'
openmode.ab =
'追加模式。(二进制方式)'
openmode['.r+b'] =
'更新模式,所有之前的数据都保留。(二进制方式)'
openmode['.w+b'] =
'更新模式,所有之前的数据都删除。(二进制方式)'
openmode['.a+b'] =
'追加更新模式,所有之前的数据都保留,只允许在文件尾部做写入。(二进制方式)'
popenmode.r =
'从这个程序中读取数据。(二进制方式)'
popenmode.w =
'向这个程序写入输入。(二进制方式)'
filetype.file =
'是一个打开的文件句柄。'
filetype['.closed file'] =
'是一个关闭的文件句柄。'
filetype['.nil'] =
'不是文件句柄。'
math =
''
math.abs =
'返回 `x` 的绝对值。'
math.acos =
'返回 `x` 的反余弦值(用弧度表示)。'
math.asin =
'返回 `x` 的反正弦值(用弧度表示)。'
math.atan['<5.2'] =
'返回 `x` 的反正切值(用弧度表示)。'
math.atan['>5.3'] =
'返回 `y/x` 的反正切值(用弧度表示)。'
math.atan2 =
'返回 `y/x` 的反正切值(用弧度表示)。'
math.ceil =
'返回不小于 `x` 的最小整数值。'
math.cos =
'返回 `x` 的余弦(假定参数是弧度)。'
math.cosh =
'返回 `x` 的双曲余弦(假定参数是弧度)。'
math.deg =
'将角 `x` 从弧度转换为角度。'
math.exp =
'返回 `e^x` 的值 e 为自然对数的底)。'
math.floor =
'返回不大于 `x` 的最大整数值。'
math.fmod =
'返回 `x` 除以 `y`,将商向零圆整后的余数。'
math.frexp =
'将 `x` 分解为尾数与指数,返回值符合 `x = m * (2 ^ e)` 。`e` 是一个整数,`m` 是 [0.5, 1) 之间的规格化小数 (`x` 为0时 `m` 为0)。'
math.huge =
'一个比任何数字值都大的浮点数。'
math.ldexp =
'返回 `m * (2 ^ e)` 。'
math.log['<5.1'] =
'返回 `x` 的自然对数。'
math.log['>5.2'] =
'回以指定底的 `x` 的对数。'
math.log10 =
'返回 `x` 的以10为底的对数。'
math.max =
'返回参数中最大的值, 大小由 Lua 操作 `<` 决定。'
math.maxinteger['>5.3'] =
'最大值的整数。'
math.min =
'返回参数中最小的值, 大小由 Lua 操作 `<` 决定。'
math.mininteger['>5.3'] =
'最小值的整数。'
math.modf =
'返回 `x` 的整数部分和小数部分。'
math.pi =
'*π* 的值。'
math.pow =
'返回 `x ^ y` 。'
math.rad =
'将角 `x` 从角度转换为弧度。'
math.random =
[[
* `math.random()`: [0,1)
* `math.random(n)`: [1, n]
* `math.random(m, n)`: [m, n]
]]
math.randomseed['<5.3'] =
'把 `x` 设为伪随机数发生器的“种子”: 相同的种子产生相同的随机数列。'
math.randomseed['>5.4'] =
[[
* `math.randomseed(x, y)`: `x` `y` 128
* `math.randomseed(x)`: `math.randomseed(x, 0)`
* `math.randomseed()`: Generates a seed with a weak attempt for randomness.
]]
math.sin =
'返回 `x` 的正弦值(假定参数是弧度)。'
math.sinh =
'返回 `x` 的双曲正弦值(假定参数是弧度)。'
math.sqrt =
'返回 `x` 的平方根。'
math.tan =
'返回 `x` 的正切值(假定参数是弧度)。'
math.tanh =
'返回 `x` 的双曲正切值(假定参数是弧度)。'
math.tointeger['>5.3'] =
'如果 `x` 可以转换为一个整数, 返回该整数。'
math.type['>5.3'] =
'如果 `x` 是整数,返回 `"integer"` 如果它是浮点数,返回 `"float"` 如果 `x` 不是数字,返回 `nil`。'
math.ult['>5.3'] =
'如果整数 `m` 和 `n` 以无符号整数形式比较, `m` 在 `n` 之下,返回布尔真否则返回假。'
os =
''
os.clock =
'返回程序使用的按秒计 CPU 时间的近似值。'
os.date =
'返回一个包含日期及时刻的字符串或表。 格式化方法取决于所给字符串 `format`。'
os.difftime =
'返回以秒计算的时刻 `t1` 到 `t2` 的差值。'
os.execute =
'调用系统解释器执行 `command`。'
os.exit['<5.1'] =
'调用 C 函数 `exit` 终止宿主程序。'
os.exit['>5.2'] =
'调用 ISO C 函数 `exit` 终止宿主程序。'
os.getenv =
'返回进程环境变量 `varname` 的值。'
os.remove =
'删除指定名字的文件。'
os.rename =
'将名字为 `oldname` 的文件或目录更名为 `newname`。'
os.setlocale =
'设置程序的当前区域。'
os.time =
'当不传参数时,返回当前时刻。 如果传入一张表,就返回由这张表表示的时刻。'
os.tmpname =
'返回一个可用于临时文件的文件名字符串。'
osdate.year =
'四位数字'
osdate.month =
'1-12'
osdate.day =
'1-31'
osdate.hour =
'0-23'
osdate.min =
'0-59'
osdate.sec =
'0-61'
osdate.wday =
'星期几1-7星期天为 1'
osdate.yday =
'当年的第几天1-366'
osdate.isdst =
'夏令时标记,一个布尔量'
package =
''
require['<5.3'] =
'加载一个模块,返回该模块的返回值(`nil`时为`true`)。'
require['>5.4'] =
'加载一个模块,返回该模块的返回值(`nil`时为`true`)与搜索器返回的加载数据。默认搜索器的加载数据指示了加载位置,对于文件来说就是文件路径。'
package.config =
'一个描述有一些为包管理准备的编译期配置信息的串。'
package.cpath =
'这个路径被 `require` 在 C 加载器中做搜索时用到。'
package.loaded =
'用于 `require` 控制哪些模块已经被加载的表。'
package.loaders =
'用于 `require` 控制如何加载模块的表。'
package.loadlib =
'让宿主程序动态链接 C 库 `libname` 。'
package.path =
'这个路径被 `require` 在 Lua 加载器中做搜索时用到。'
package.preload =
'保存有一些特殊模块的加载器。'
package.searchers =
'用于 `require` 控制如何加载模块的表。'
package.searchpath =
'在指定 `path` 中搜索指定的 `name` 。'
package.seeall =
'给 `module` 设置一个元表,该元表的 `__index` 域为全局环境,这样模块便会继承全局环境的值。可作为 `module` 函数的选项。'
string =
''
string.byte =
'返回字符 `s[i]` `s[i+1]` ... `s[j]` 的内部数字编码。'
string.char =
'接收零或更多的整数。 返回和参数数量相同长度的字符串。 其中每个字符的内部编码值等于对应的参数值。'
string.dump =
'返回包含有以二进制方式表示的(一个 *二进制代码块* )指定函数的字符串。'
string.find =
'查找第一个字符串中匹配到的 `pattern`(参见 §6.4.1)。'
string.format =
'返回不定数量参数的格式化版本,格式化串为第一个参数。'
string.gmatch =
[[
`pattern`  §6.4.1 s
s
```lua
s =
"hello world from Lua"
for w in string.gmatch(s, "%a+") do
print(w)
end
```
]]
string.gsub =
'将字符串 s 中,所有的(或是在 n 给出时的前 n 个) pattern (参见 §6.4.1)都替换成 repl ,并返回其副本。'
string.len =
'返回其长度。'
string.lower =
'将其中的大写字符都转为小写后返回其副本。'
string.match =
'在字符串 s 中找到第一个能用 pattern (参见 §6.4.1)匹配到的部分。 如果能找到match 返回其中的捕获物; 否则返回 nil 。'
string.pack =
'返回一个打包了(即以二进制形式序列化) v1, v2 等值的二进制字符串。 字符串 fmt 为打包格式(参见 §6.4.2)。'
string.packsize =
[[返回以指定格式用 $string.pack 打包的字符串的长度。 格式化字符串中不可以有变长选项 's' 或 'z' (参见 §6.4.2)。]]
string.rep['>5.2'] =
'返回 `n` 个字符串 `s` 以字符串 `sep` 为分割符连在一起的字符串。 默认的 `sep` 值为空字符串(即没有分割符)。 如果 `n` 不是正数则返回空串。'
string.rep['<5.1'] =
'返回 `n` 个字符串 `s` 连在一起的字符串。 如果 `n` 不是正数则返回空串。'
string.reverse =
'返回字符串 s 的翻转串。'
string.sub =
'返回字符串的子串, 该子串从 `i` 开始到 `j` 为止。'
string.unpack =
'返回以格式 fmt (参见 §6.4.2 打包在字符串 s (参见 string.pack 中的值。'
string.upper =
'接收一个字符串,将其中的小写字符都转为大写后返回其副本。'
table =
''
table.concat =
'提供一个列表,其所有元素都是字符串或数字,返回字符串 `list[i]..sep..list[i+1] ··· sep..list[j]`。'
table.insert =
'在 `list` 的位置 `pos` 处插入元素 `value`。'
table.maxn =
'返回给定表的最大正数索引,如果表没有正数索引,则返回零。'
table.move =
[[
`a1` `a2`
```lua
a2[t],··· =
a1[f],···,a1[e]
return a2
```
]]
table.pack =
'返回用所有参数以键 `1`,`2`, 等填充的新表, 并将 `"n"` 这个域设为参数的总数。'
table.remove =
'移除 `list` 中 `pos` 位置上的元素,并返回这个被移除的值。'
table.sort =
'在表内从 `list[1]` 到 `list[#list]` *原地* 对其间元素按指定次序排序。'
table.unpack =
[[
```lua
return list[i], list[i+1], ···, list[j]
```
i 1 j #list
]]
table.foreach =
'遍历表中的每一个元素并以key和value执行回调函数。如果回调函数返回一个非nil值则循环终止,并且返回这个值。该函数等同pair(list),比pair(list)更慢。不推荐使用'
table.foreachi =
'遍历数组中的每一个元素并以索引号index和value执行回调函数。如果回调函数返回一个非nil值则循环终止,并且返回这个值。该函数等同ipair(list),比ipair(list)更慢。不推荐使用'
table.getn =
'返回表的长度。该函数等价于#list。'
table.new = -- TODO: need translate!
[[This creates a pre-sized table, just like the C API equivalent `lua_createtable()`. This is useful for big tables if the final table size is known and automatic table resizing is too expensive. `narray` parameter specifies the number of array-like items, and `nhash` parameter specifies the number of hash-like items. The function needs to be required before use.
```lua
require("table.new")
```
]]
table.clear = -- TODO: need translate!
[[This clears all keys and values from a table, but preserves the allocated array/hash sizes. This is useful when a table, which is linked from multiple places, needs to be cleared and/or when recycling a table for use by the same context. This avoids managing backlinks, saves an allocation and the overhead of incremental array/hash part growth. The function needs to be required before use.
```lua
require("table.clear").
```
Please note this function is meant for very specific situations. In most cases it's better to replace the (usually single) link with a new table and let the GC do its work.
]]
utf8 =
''
utf8.char =
'接收零或多个整数, 将每个整数转换成对应的 UTF-8 字节序列,并返回这些序列连接到一起的字符串。'
utf8.charpattern =
'用于精确匹配到一个 UTF-8 字节序列的模式,它假定处理的对象是一个合法的 UTF-8 字符串。'
utf8.codes =
[[
```lua
for p, c in utf8.codes(s) do
body
end
```
s p c
]]
utf8.codepoint =
'以整数形式返回 `s` 中 从位置 `i` 到 `j` 间(包括两端) 所有字符的编号。'
utf8.len =
'返回字符串 `s` 中 从位置 `i` 到 `j` 间 (包括两端) UTF-8 字符的个数。'
utf8.offset =
'返回编码在 `s` 中的第 `n` 个字符的开始位置(按字节数) (从位置 `i` 处开始统计)。'

View file

@ -0,0 +1,435 @@
---@diagnostic disable: undefined-global
config.addonManager.enable =
"是否启用扩展的附加插件管理器(Addon Manager)"
config.runtime.version =
"Lua运行版本。"
config.runtime.path =
[[
使 `require`
`?/init.lua` `require 'myfile'` `{workspace}/myfile/init.lua`
`runtime.pathStrict` `false` `${workspace}/**/myfile/init.lua`
`Lua.workspace.library`
]]
config.runtime.pathStrict =
'启用后 `runtime.path` 将只搜索第一层目录,见 `runtime.path` 的说明。'
config.runtime.special =
[[
`include` `require`
```json
"Lua.runtime.special" : {
"include" : "require"
}
```
]]
config.runtime.unicodeName =
"允许在名字中使用 Unicode 字符。"
config.runtime.nonstandardSymbol =
"支持非标准的符号。请务必确认你的运行环境支持这些符号。"
config.runtime.plugin =
"插件路径,请查阅[文档](https://luals.github.io/wiki/plugins)了解用法。"
config.runtime.pluginArgs = -- TODO: need translate!
"Additional arguments for the plugin."
config.runtime.fileEncoding =
"文件编码,`ansi` 选项只在 `Windows` 平台下有效。"
config.runtime.builtin =
[[
* `default`:
* `enable`:
* `disable`:
]]
config.runtime.meta =
'meta文件的目录名称格式。'
config.diagnostics.enable =
"启用诊断。"
config.diagnostics.disable =
"禁用的诊断(使用浮框括号内的代码)。"
config.diagnostics.globals =
"已定义的全局变量。"
config.diagnostics.severity =
[[
`!` `diagnostics.groupSeverity`
]]
config.diagnostics.neededFileStatus =
[[
* Opened:
* Any:
* None:
`!` `diagnostics.groupFileStatus`
]]
config.diagnostics.groupSeverity =
[[
`Fallback` `diagnostics.severity`
`!`
]]
config.diagnostics.groupFileStatus =
[[
* Opened:
* Any:
* None:
`Fallback` `diagnostics.neededFileStatus`
`!`
]]
config.diagnostics.workspaceEvent =
"设置触发工作区诊断的时机。"
config.diagnostics.workspaceEvent.OnChange =
"当文件发生变化时触发工作区诊断。"
config.diagnostics.workspaceEvent.OnSave =
"当文件保存时触发工作区诊断。"
config.diagnostics.workspaceEvent.None =
"关闭工作区诊断。"
config.diagnostics.workspaceDelay =
"进行工作区诊断的延迟(毫秒)。"
config.diagnostics.workspaceRate =
"工作区诊断的运行速率百分比。降低该值会减少CPU占用但是也会降低工作区诊断的速度。你当前正在编辑的文件的诊断总是全速完成不受该选项影响。"
config.diagnostics.libraryFiles =
"如何诊断通过 `Lua.workspace.library` 加载的文件。"
config.diagnostics.libraryFiles.Enable =
"总是诊断这些文件。"
config.diagnostics.libraryFiles.Opened =
"只有打开这些文件时才会诊断。"
config.diagnostics.libraryFiles.Disable =
"不诊断这些文件。"
config.diagnostics.ignoredFiles =
"如何诊断被忽略的文件。"
config.diagnostics.ignoredFiles.Enable =
"总是诊断这些文件。"
config.diagnostics.ignoredFiles.Opened =
"只有打开这些文件时才会诊断。"
config.diagnostics.ignoredFiles.Disable =
"不诊断这些文件。"
config.diagnostics.disableScheme =
'不诊断使用以下 scheme 的lua文件。'
config.diagnostics.unusedLocalExclude =
'如果变量名匹配以下规则,则不对其进行 `unused-local` 诊断。'
config.workspace.ignoreDir =
"忽略的文件与目录(使用 `.gitignore` 语法)。"
config.workspace.ignoreSubmodules =
"忽略子模块。"
config.workspace.useGitIgnore =
"忽略 `.gitignore` 中列举的文件。"
config.workspace.maxPreload =
"最大预加载文件数。"
config.workspace.preloadFileSize =
"预加载时跳过大小大于该值KB的文件。"
config.workspace.library =
"除了当前工作区以外,还会从哪些目录中加载文件。这些目录中的文件将被视作外部提供的代码库,部分操作(如重命名字段)不会修改这些文件。"
config.workspace.checkThirdParty =
[[
* OpenResty
* Cocos4.0
* LÖVE
* LÖVR
* skynet
* Jass
]]
config.workspace.userThirdParty =
'在这里添加私有的第三方库适配文件路径,请参考内置的[配置文件路径](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)'
config.workspace.supportScheme =
'为以下 scheme 的lua文件提供语言服务。'
config.completion.enable =
'启用自动完成。'
config.completion.callSnippet =
'显示函数调用片段。'
config.completion.callSnippet.Disable =
"只显示 `函数名`。"
config.completion.callSnippet.Both =
"显示 `函数名` 与 `调用片段`。"
config.completion.callSnippet.Replace =
"只显示 `调用片段`。"
config.completion.keywordSnippet =
'显示关键字语法片段'
config.completion.keywordSnippet.Disable =
"只显示 `关键字`。"
config.completion.keywordSnippet.Both =
"显示 `关键字` 与 `语法片段`。"
config.completion.keywordSnippet.Replace =
"只显示 `语法片段`。"
config.completion.displayContext =
"预览建议的相关代码片段,可能可以帮助你了解这项建议的用法。设置的数字表示代码片段的截取行数,设置为`0`可以禁用此功能。"
config.completion.workspaceWord =
"显示的上下文单词是否包含工作区中其他文件的内容。"
config.completion.showWord =
"在建议中显示上下文单词。"
config.completion.showWord.Enable =
"总是在建议中显示上下文单词。"
config.completion.showWord.Fallback =
"无法根据语义提供建议时才显示上下文单词。"
config.completion.showWord.Disable =
"不显示上下文单词。"
config.completion.autoRequire =
"输入内容看起来是个文件名时,自动 `require` 此文件。"
config.completion.showParams =
"在建议列表中显示函数的参数信息,函数拥有多个定义时会分开显示。"
config.completion.requireSeparator =
"`require` 时使用的分隔符。"
config.completion.postfix =
"用于触发后缀建议的符号。"
config.color.mode =
"着色模式。"
config.color.mode.Semantic =
"语义着色。你可能需要同时将 `editor.semanticHighlighting.enabled` 设置为 `true` 才能生效。"
config.color.mode.SemanticEnhanced =
"增强的语义颜色。 类似于`Semantic`,但会进行额外的分析(也会带来额外的开销)。"
config.color.mode.Grammar =
"语法着色。"
config.semantic.enable =
"启用语义着色。你可能需要同时将 `editor.semanticHighlighting.enabled` 设置为 `true` 才能生效。"
config.semantic.variable =
"对变量/字段/参数进行语义着色。"
config.semantic.annotation =
"对类型注解进行语义着色。"
config.semantic.keyword =
"对关键字/字面量/运算符进行语义着色。只有当你的编辑器无法进行语法着色时才需要启用此功能。"
config.signatureHelp.enable =
"启用参数提示。"
config.hover.enable =
"启用悬停提示。"
config.hover.viewString =
"悬停提示查看字符串内容(仅当字面量包含转义符时)。"
config.hover.viewStringMax =
"悬停提示查看字符串内容时的最大长度。"
config.hover.viewNumber =
"悬停提示查看数字内容(仅当字面量不是十进制时)。"
config.hover.fieldInfer =
"悬停提示查看表时,会对表的每个字段进行类型推测,当类型推测的用时累计达到该设定值(毫秒)时,将跳过后续字段的类型推测。"
config.hover.previewFields =
"悬停提示查看表时,限制表内字段的最大预览数量。"
config.hover.enumsLimit =
"当值对应多个类型时,限制类型的显示数量。"
config.hover.expandAlias =
[[
`---@alias myType boolean|number` 展开后显示为 `boolean|number`,否则显示为 `myType`。
]]
config.develop.enable =
'开发者模式。请勿开启,会影响性能。'
config.develop.debuggerPort =
'调试器监听端口。'
config.develop.debuggerWait =
'调试器连接之前挂起。'
config.intelliSense.searchDepth =
'设置智能感知的搜索深度。增大该值可以增加准确度,但会降低性能。不同的项目对该设置的容忍度差异较大,请自己调整为合适的值。'
config.intelliSense.fastGlobal =
'在对全局变量进行补全,及查看 `_G` 的悬浮提示时进行优化。这会略微降低类型推测的准确度,但是对于大量使用全局变量的项目会有大幅的性能提升。'
config.window.statusBar =
'在状态栏显示插件状态。'
config.window.progressBar =
'在状态栏显示进度条。'
config.hint.enable =
'启用内联提示。'
config.hint.paramType =
'在函数的参数位置提示类型。'
config.hint.setType =
'在赋值操作位置提示类型。'
config.hint.paramName =
'在函数调用处提示参数名。'
config.hint.paramName.All =
'所有类型的参数均进行提示。'
config.hint.paramName.Literal =
'只有字面量类型的参数进行提示。'
config.hint.paramName.Disable =
'禁用参数提示。'
config.hint.arrayIndex =
'在构造表时提示数组索引。'
config.hint.arrayIndex.Enable =
'所有的表中都提示数组索引。'
config.hint.arrayIndex.Auto =
'只有表大于3项或者表是混合类型时才进行提示。'
config.hint.arrayIndex.Disable =
'禁用数组索引提示。'
config.hint.await =
'如果调用的函数被标记为了 `---@async` ,则在调用处提示 `await` 。'
config.hint.semicolon =
'若语句尾部没有分号,则显示虚拟分号。'
config.hint.semicolon.All =
'所有语句都显示虚拟分号。'
config.hint.semicolon.SameLine =
'2个语句在同一行时在它们之间显示分号。'
config.hint.semicolon.Disable =
'禁用虚拟分号。'
config.codeLens.enable =
'启用代码度量。'
config.format.enable =
'启用代码格式化程序。'
config.format.defaultConfig =
[[
`.editorconfig`
[](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs)
]]
config.spell.dict =
'拼写检查的自定义单词。'
config.nameStyle.config =
'设定命名风格检查的配置'
config.telemetry.enable =
[[
[](https://luals.github.io/privacy/#language-server)
]]
config.misc.parameters =
'VSCode中启动语言服务时的[命令行参数](https://luals.github.io/wiki/usage#arguments)。'
config.misc.executablePath =
'VSCode中指定可执行文件路径。'
config.type.castNumberToInteger =
'允许将 `number` 类型赋给 `integer` 类型。'
config.type.weakUnionCheck =
[[
`false` `number|boolean` `number` `true`
]]
config.type.weakNilCheck =
[[
`nil`
`false` `numer|nil` `number` `true`
]]
config.doc.privateName =
'将特定名称的字段视为私有,例如 `m_*` 意味着 `XXX.m_id` 与 `XXX.m_type` 是私有字段,只能在定义所在的类中访问。'
config.doc.protectedName =
'将特定名称的字段视为受保护,例如 `m_*` 意味着 `XXX.m_id` 与 `XXX.m_type` 是受保护的字段,只能在定义所在的类极其子类中访问。'
config.doc.packageName =
'将特定名称的字段视为package例如 `m_*` 意味着 `XXX.m_id` 与 `XXX.m_type` 只能在定义所在的文件中访问。'
config.diagnostics['unused-local'] =
'未使用的局部变量'
config.diagnostics['unused-function'] =
'未使用的函数'
config.diagnostics['undefined-global'] =
'未定义的全局变量'
config.diagnostics['global-in-nil-env'] =
'不能使用全局变量( `_ENV` 被设置为了 `nil`'
config.diagnostics['unused-label'] =
'未使用的标签'
config.diagnostics['unused-vararg'] =
'未使用的不定参数'
config.diagnostics['trailing-space'] =
'后置空格'
config.diagnostics['redefined-local'] =
'重复定义的局部变量'
config.diagnostics['newline-call'] =
'以 `(` 开始的新行,在语法上被解析为了上一行的函数调用'
config.diagnostics['newfield-call'] =
'在字面量表中2行代码之间缺少分隔符在语法上被解析为了一次索引操作'
config.diagnostics['redundant-parameter'] =
'函数调用时,传入了多余的参数'
config.diagnostics['ambiguity-1'] =
'优先级歧义,如:`num or 0 + 1`,推测用户的实际期望为 `(num or 0) + 1` '
config.diagnostics['lowercase-global'] =
'首字母小写的全局变量定义'
config.diagnostics['undefined-env-child'] =
'`_ENV` 被设置为了新的字面量表,但是试图获取的全局变量不再这张表中'
config.diagnostics['duplicate-index'] =
'在字面量表中重复定义了索引'
config.diagnostics['empty-block'] =
'空代码块'
config.diagnostics['redundant-value'] =
'赋值操作时,值的数量比被赋值的对象多'
config.diagnostics['assign-type-mismatch'] =
'值类型与赋值变量类型不匹配'
config.diagnostics['await-in-sync'] =
'同步函数中异步函数调用'
config.diagnostics['cast-local-type'] =
'已显式定义变量类型与要定义的值的类型不匹配'
config.diagnostics['cast-type-mismatch'] =
'变量被转换为与其初始类型不匹配的类型'
config.diagnostics['circular-doc-class'] =
'两个类相互继承并互相循环'
config.diagnostics['close-non-object'] = -- TODO: need translate!
'Enable diagnostics for attempts to close a variable with a non-object.'
config.diagnostics['code-after-break'] =
'放在循环中break语句后面的代码'
config.diagnostics['codestyle-check'] = -- TODO: need translate!
'Enable diagnostics for incorrectly styled lines.'
config.diagnostics['count-down-loop'] =
'for循环永远无法达到最大/极限值(在递减时递增)'
config.diagnostics['deprecated'] =
'变量已被标记为deprecated(过时)但仍在使用'
config.diagnostics['different-requires'] =
'required的同一个文件使用了两个不同的名字'
config.diagnostics['discard-returns'] =
'函数的返回值被忽略(函数被`@nodiscard`标记时)'
config.diagnostics['doc-field-no-class'] =
'为不存在的类`@class`标记`@field`字段'
config.diagnostics['duplicate-doc-alias'] =
'`@alias`字段的名字冲突'
config.diagnostics['duplicate-doc-field'] =
'`@field`字段的名字冲突'
config.diagnostics['duplicate-doc-param'] =
'`@param`字段的名字冲突'
config.diagnostics['duplicate-set-field'] =
'在一个类中多次定义同一字段'
config.diagnostics['incomplete-signature-doc'] =
'`@param`或`@return`的注释不完整'
config.diagnostics['invisible'] =
'使用不可见的值'
config.diagnostics['missing-global-doc'] =
'全局变量的注释缺失(全局函数必须为所有参数和返回值提供注释和注释)'
config.diagnostics['missing-local-export-doc'] =
'导出的本地函数缺少注释(导出的本地函数必须有包括本身以及所有参数和返回值的注释)'
config.diagnostics['missing-parameter'] =
'函数参数数少于注释函数参数数'
config.diagnostics['missing-return'] =
'函数带有返回注释而无返回语句'
config.diagnostics['missing-return-value'] =
'函数无值返回但函数使用`@return`标记了返回值'
config.diagnostics['need-check-nil'] =
'变量之前被赋值为`nil`或可选值(可能为 `nil`)'
config.diagnostics['no-unknown'] =
'变量的未知类型无法推断'
config.diagnostics['not-yieldable'] =
'不允许调用 `coroutine.yield()` '
config.diagnostics['param-type-mismatch'] =
'给定参数的类型与函数定义所要求的类型(`@param`)不匹配'
config.diagnostics['redundant-return'] =
'当放置一个不需要的返回值时触发(函数会自行退出)'
config.diagnostics['redundant-return-value']=
'返回`@return`注释未指定的额外值'
config.diagnostics['return-type-mismatch'] =
'返回值的类型与`@return`中声明的类型不匹配'
config.diagnostics['spell-check'] = -- TODO: need translate!
'Enable diagnostics for typos in strings.'
config.diagnostics['name-style-check'] = -- TODO: need translate!
'变量的名称样式检查'
config.diagnostics['unbalanced-assignments']=
'多重赋值时没有赋值所有变量(如`local x,y = 1`)'
config.diagnostics['undefined-doc-class'] =
'在`@class`注解中引用未定义的类。'
config.diagnostics['undefined-doc-name'] =
'在`@type`注解中引用未定义的类型或`@alias`'
config.diagnostics['undefined-doc-param'] =
'函数声明中`@param`引用了未定义的参数'
config.diagnostics['undefined-field'] =
'引用变量的未定义字段'
config.diagnostics['unknown-cast-variable'] =
'使用`@cast`对未定义变量的强制转换'
config.diagnostics['unknown-diag-code'] =
'未知的诊断代码'
config.diagnostics['unknown-operator'] =
'未知的运算符'
config.diagnostics['unreachable-code'] =
'不可达的代码'
config.diagnostics['global-element'] = -- TODO: need translate!
'Enable diagnostics to warn about global elements.'
config.typeFormat.config =
'配置输入Lua代码时的格式化行为'
config.typeFormat.config.auto_complete_end =
'是否在合适的位置自动完成 `end`'
config.typeFormat.config.auto_complete_table_sep =
'是否在table末尾自动添加分隔符'
config.typeFormat.config.format_line =
'是否对某一行进行格式化'
command.exportDocument =
'Lua: 导出文档...'
command.addon_manager.open =
'Lua: 打开插件管理器...'
command.reloadFFIMeta =
'Lua: 重新生成luajit的FFI模块C语言元数据'

View file

@ -0,0 +1,743 @@
---@diagnostic disable: undefined-global, lowercase-global
arg =
'獨立版Lua的啟動引數。'
assert =
'如果其引數 `v` 的值為假( `nil` 或 `false` ),它就呼叫 $error ;否則,回傳所有的引數。在錯誤情況時, `message` 指那個錯誤對象;如果不提供這個引數,預設為 `"assertion failed!"` 。'
cgopt.collect =
'做一次完整的垃圾回收循環。'
cgopt.stop =
'停止垃圾回收器的執行。'
cgopt.restart =
'重新啟動垃圾回收器的自動執行。'
cgopt.count =
'以 K 位元組數為單位回傳 Lua 使用的總記憶體數。'
cgopt.step =
'單步執行垃圾回收器。 步長“大小”由 `arg` 控制。'
cgopt.setpause =
'將 `arg` 設為回收器的 *間歇率* 。'
cgopt.setstepmul =
'將 `arg` 設為回收器的 *步進倍率* 。'
cgopt.incremental =
'改變回收器模式為增量模式。'
cgopt.generational =
'改變回收器模式為分代模式。'
cgopt.isrunning =
'回傳表示回收器是否在工作的布林值。'
collectgarbage =
'這個函式是垃圾回收器的一般介面。透過引數 opt 它提供了一組不同的功能。'
dofile =
'打開該名字的檔案,並執行檔案中的 Lua 程式碼區塊。不帶引數呼叫時, `dofile` 執行標準輸入的內容(`stdin`)。回傳該程式碼區塊的所有回傳值。對於有錯誤的情況, `dofile` 將錯誤回饋給呼叫者(即 `dofile` 沒有執行在保護模式下)。'
error =
[[
`message` `error`
`message` `error` `level`
]]
_G =
'一個全域變數(非函式),內部儲存有全域環境(參見 §2.2)。 Lua 自己不使用這個變數;改變這個變數的值不會對任何環境造成影響,反之亦然。'
getfenv =
'回傳給定函式的環境。 `f` 可以是一個Lua函式也可是一個表示呼叫堆疊層級的數字。'
getmetatable =
'如果 `object` 不包含中繼資料表,回傳 `nil` 。否則,如果在該物件的中繼資料表中有 `"__metatable"` 域時回傳其關聯值,沒有時回傳該對象的中繼資料表。'
ipairs =
[[
`t` `0`
```lua
for i,v in ipairs(t) do body end
```
`(1,t[1])(2,t[2])...`
]]
loadmode.b =
'只能是二進制程式碼區塊。'
loadmode.t =
'只能是文字程式碼區塊。'
loadmode.bt =
'可以是二進制也可以是文字。'
load['<5.1'] =
'使用 `func` 分段載入程式碼區塊。每次呼叫 `func` 必須回傳一個字串用於連接前文。'
load['>5.2'] =
[[
`chunk` `chunk` `load` `chunk` `nil`
]]
loadfile =
'從檔案 `filename` 或標準輸入(如果檔名未提供)中獲取程式碼區塊。'
loadstring =
'使用給定字串載入程式碼區塊。'
module =
'建立一個模組。'
next =
[[
`next` `nil` `next` `nil` `next` `nil` `nil` `next(t)`
使使 `for`
`next`
]]
pairs =
[[
`t` `__pairs` `t`
`next` `t` `nil`
```lua
for k,v in pairs(t) do body end
```
`t`
$next
]]
pcall =
'透過將函式 `f` 傳入引數,以 *保護模式* 呼叫 `f` 。這意味著 `f` 中的任何錯誤不會擲回;取而代之的是, `pcall` 會將錯誤捕獲到,並回傳一個狀態碼。第一個回傳值是狀態碼(一個布林值),當沒有錯誤時,其為 `true` 。此時, `pcall` 同樣會在狀態碼後回傳所有呼叫的結果。在有錯誤時,`pcall` 回傳 `false` 加錯誤訊息。'
print =
'接收任意數量的引數,並將它們的值列印到 `stdout`。它用 `tostring` 函式將每個引數都轉換為字串。 `print` 不用於做格式化輸出。僅作為看一下某個值的快捷方式,多用於除錯。完整的對輸出的控制,請使用 $string.format 以及 $io.write。'
rawequal =
'在不觸發任何元方法的情況下,檢查 `v1` 是否和 `v2` 相等。回傳一個布林值。'
rawget =
'在不觸發任何元方法的情況下,獲取 `table[index]` 的值。 `table` 必須是一張表; `index` 可以是任何值。'
rawlen =
'在不觸發任何元方法的情況下,回傳物件 `v` 的長度。 `v` 可以是表或字串。它回傳一個整數。'
rawset =
[[
`table[index]` `value` `table` `index` `nil` `NaN` `value` Lua
`table`
]]
select =
'如果 `index` 是個數字,那麼回傳引數中第 `index` 個之後的部分;負的數字會從後向前索引(`-1` 指最後一個引數)。否則, `index` 必須是字串 `"#"` ,此時 `select` 回傳引數的個數。'
setfenv =
'設定給定函式的環境。'
setmetatable =
[[
Lua C `metatable` `nil` `"__metatable"`
]]
tonumber =
[[
`base` `tonumber` `tonumber` `fail`
Lua §3.1
]]
tostring =
[[
`v` `"__tostring"` `tostring` `v`
使 $string.format
]]
type =
[[
`"nil"` `nil` `"number"` `"string"` `"boolean"` `"table"` `"function"` `"thread"` `"userdata"`
]]
_VERSION =
'一個包含有目前直譯器版本號的全域變數(並非函式)。'
warn =
'使用所有引數組成的字串訊息來發送警告。'
xpcall['=5.1'] =
'透過將函式 `f` 傳入引數,以 *保護模式* 呼叫 `f` 。這個函式和 `pcall` 類似。不過它可以額外設定一個訊息處理器 `err`。'
xpcall['>5.2'] =
'透過將函式 `f` 傳入引數,以 *保護模式* 呼叫 `f` 。這個函式和 `pcall` 類似。不過它可以額外設定一個訊息處理器 `msgh`。'
unpack =
[[
`list`
```lua
return list[i], list[i+1], ···, list[j]
```
]]
bit32 =
''
bit32.arshift =
[[
`x` `disp` `disp` 使 `x` 使 `0`
]]
bit32.band =
'回傳參數按位元及的結果。'
bit32.bnot =
[[
`x`
```lua
assert(bit32.bnot(x) ==
(-1 - x) % 2^32)
```
]]
bit32.bor =
'回傳參數按位元或的結果。'
bit32.btest =
'參數按位元與的結果不為 `0` 時,回傳 `true` 。'
bit32.bxor =
'回傳參數按位元互斥或的結果。'
bit32.extract =
'回傳 `n` 中第 `field` 到第 `field + width - 1` 位組成的結果。'
bit32.replace =
'回傳 `v` 的第 `field` 到第 `field + width - 1` 位替換 `n` 的對應位後的結果。'
bit32.lrotate =
'回傳 `x` 向左旋轉 `disp` 位的結果。`disp` 為負時向右旋轉。'
bit32.lshift =
[[
`x` `disp` `disp` 使 `0`
```lua
assert(bit32.lshift(b, disp) ==
(b * 2^disp) % 2^32)
```
]]
bit32.rrotate =
'回傳 `x` 向右旋轉 `disp` 位的結果。`disp` 為負時向左旋轉。'
bit32.rshift =
[[
`x` `disp` `disp` 使 `0`
```lua
assert(bit32.lshift(b, disp) ==
(b * 2^disp) % 2^32)
```
]]
coroutine =
''
coroutine.create =
'建立一個主體函式為 `f` 的新共常式。 f 必須是一個 Lua 的函式。回傳這個新共常式,它是一個類型為 `"thread"` 的物件。'
coroutine.isyieldable =
'如果正在執行的共常式可以讓出,則回傳真。'
coroutine.isyieldable['>5.4'] =
'如果共常式 `co` 可以讓出,則回傳真。 `co` 預設為正在執行的共常式。'
coroutine.close =
'關閉共常式 `co` ,並關閉它所有等待 *to-be-closed* 的變數,並將共常式狀態設為 `dead` 。'
coroutine.resume =
'開始或繼續共常式 `co` 的執行。'
coroutine.running =
'回傳目前正在執行的共常式加一個布林值。如果目前執行的共常式是主執行緒,其為真。'
coroutine.status =
'以字串形式回傳共常式 `co` 的狀態。'
coroutine.wrap =
'建立一個主體函式為 `f` 的新共常式。 f 必須是一個 Lua 的函式。回傳一個函式,每次呼叫該函式都會延續該共常式。'
coroutine.yield =
'懸置正在呼叫的共常式的執行。'
costatus.running =
'正在執行。'
costatus.suspended =
'懸置或是還沒有開始執行。'
costatus.normal =
'是活動的,但並不在執行。'
costatus.dead =
'執行完主體函式或因錯誤停止。'
debug =
''
debug.debug =
'進入一個使用者互動模式,執行使用者輸入的每個字串。'
debug.getfenv =
'回傳物件 `o` 的環境。'
debug.gethook =
'回傳三個表示執行緒攔截設定的值:目前攔截函式,目前攔截遮罩,目前攔截計數。'
debug.getinfo =
'回傳關於一個函式資訊的表。'
debug.getlocal['<5.1'] =
'回傳在堆疊的 `level` 層處函式的索引為 `index` 的區域變數的名字和值。'
debug.getlocal['>5.2'] =
'回傳在堆疊的 `f` 層處函式的索引為 `index` 的區域變數的名字和值。'
debug.getmetatable =
'回傳給定 `value` 的中繼資料表。'
debug.getregistry =
'回傳註冊表。'
debug.getupvalue =
'回傳函式 `f` 的第 `up` 個上值的名字和值。'
debug.getuservalue['<5.3']=
'回傳關聯在 `u` 上的 `Lua` 值。'
debug.getuservalue['>5.4']=
'回傳關聯在 `u` 上的第 `n` 個 `Lua` 值,以及一個布林, `false` 表示值不存在。'
debug.setcstacklimit =
[[
### ** `Lua 5.4.2` **
C堆疊限制Lua中巢狀呼叫的深度
`false`
]]
debug.setfenv =
'將 `table` 設定為 `object` 的環境。'
debug.sethook =
'將一個函式設定為攔截函式。'
debug.setlocal =
'將 `value` 賦給 堆疊上第 `level` 層函式的第 `local` 個區域變數。'
debug.setmetatable =
'將 `value` 的中繼資料表設為 `table` (可以是 `nil` )。'
debug.setupvalue =
'將 `value` 設為函式 `f` 的第 `up` 個上值。'
debug.setuservalue['<5.3']=
'將 `value` 設為 `udata` 的關聯值。'
debug.setuservalue['>5.4']=
'將 `value` 設為 `udata` 的第 `n` 個關聯值。'
debug.traceback =
'回傳呼叫堆疊的堆疊回溯資訊。字串可選項 `message` 被添加在堆疊回溯資訊的開頭。'
debug.upvalueid =
'回傳指定函式第 `n` 個上值的唯一識別字(一個輕量使用者資料)。'
debug.upvaluejoin =
'讓 Lua 閉包 `f1` 的第 `n1` 個上值 引用 `Lua` 閉包 `f2` 的第 `n2` 個上值。'
infowhat.n =
'`name` 和 `namewhat`'
infowhat.S =
'`source` 、 `short_src` 、 `linedefined` 、 `lalinedefined` 和 `what`'
infowhat.l =
'`currentline`'
infowhat.t =
'`istailcall`'
infowhat.u['<5.1'] =
'`nups`'
infowhat.u['>5.2'] =
'`nups` 、 `nparams` 和 `isvararg`'
infowhat.f =
'`func`'
infowhat.r =
'`ftransfer` 和 `ntransfer`'
infowhat.L =
'`activelines`'
hookmask.c =
'每當 Lua 呼叫一個函式時,呼叫攔截。'
hookmask.r =
'每當 Lua 從一個函式內回傳時,呼叫攔截。'
hookmask.l =
'每當 Lua 進入新的一行時,呼叫攔截。'
file =
''
file[':close'] =
'關閉 `file`。'
file[':flush'] =
'將寫入的資料儲存到 `file` 中。'
file[':lines'] =
[[
------
```lua
for c in file:lines(...) do
body
end
```
]]
file[':read'] =
'讀取檔案 `file` ,指定的格式決定了要讀取什麼。'
file[':seek'] =
'設定及獲取基於檔案開頭處計算出的位置。'
file[':setvbuf'] =
'設定輸出檔案的緩衝模式。'
file[':write'] =
'將引數的值逐個寫入 `file` 。'
readmode.n =
'讀取一個數字,根據 Lua 的轉換文法回傳浮點數或整數。'
readmode.a =
'從目前位置開始讀取整個檔案。'
readmode.l =
'讀取一行並忽略行尾標記。'
readmode.L =
'讀取一行並保留行尾標記。'
seekwhence.set =
'基點為 0 (檔案開頭)。'
seekwhence.cur =
'基點為目前位置。'
seekwhence['.end'] =
'基點為檔案尾。'
vbuf.no =
'不緩衝;輸出操作立刻生效。'
vbuf.full =
'完全緩衝;只有在快取滿或呼叫 flush 時才做輸出操作。'
vbuf.line =
'行緩衝;輸出將緩衝到每次換行前。'
io =
''
io.stdin =
'標準輸入。'
io.stdout =
'標準輸出。'
io.stderr =
'標準錯誤。'
io.close =
'關閉 `file` 或預設輸出檔案。'
io.flush =
'將寫入的資料儲存到預設輸出檔案中。'
io.input =
'設定 `file` 為預設輸入檔案。'
io.lines =
[[
------
```lua
for c in io.lines(filename, ...) do
body
end
```
]]
io.open =
'用字串 `mode` 指定的模式打開一個檔案。'
io.output =
'設定 `file` 為預設輸出檔案。'
io.popen =
'用一個分離處理程序開啟程式 `prog` 。'
io.read =
'讀取檔案 `file` ,指定的格式決定了要讀取什麼。'
io.tmpfile =
'如果成功,回傳一個臨時檔案的控制代碼。'
io.type =
'檢查 `obj` 是否是合法的檔案控制代碼。'
io.write =
'將引數的值逐個寫入預設輸出檔案。'
openmode.r =
'讀取模式。'
openmode.w =
'寫入模式。'
openmode.a =
'追加模式。'
openmode['.r+'] =
'更新模式,所有之前的資料都保留。'
openmode['.w+'] =
'更新模式,所有之前的資料都刪除。'
openmode['.a+'] =
'追加更新模式,所有之前的資料都保留,只允許在檔案尾部做寫入。'
openmode.rb =
'讀取模式。(二進制方式)'
openmode.wb =
'寫入模式。(二進制方式)'
openmode.ab =
'追加模式。(二進制方式)'
openmode['.r+b'] =
'更新模式,所有之前的資料都保留。(二進制方式)'
openmode['.w+b'] =
'更新模式,所有之前的資料都刪除。(二進制方式)'
openmode['.a+b'] =
'追加更新模式,所有之前的資料都保留,只允許在檔案尾部做寫入。(二進制方式)'
popenmode.r =
'從這個程式中讀取資料。(二進制方式)'
popenmode.w =
'向這個程式寫入輸入。(二進制方式)'
filetype.file =
'是一個打開的檔案控制代碼。'
filetype['.closed file'] =
'是一個關閉的檔案控制代碼。'
filetype['.nil'] =
'不是檔案控制代碼。'
math =
''
math.abs =
'回傳 `x` 的絕對值。'
math.acos =
'回傳 `x` 的反餘弦值(用弧度表示)。'
math.asin =
'回傳 `x` 的反正弦值(用弧度表示)。'
math.atan['<5.2'] =
'回傳 `x` 的反正切值(用弧度表示)。'
math.atan['>5.3'] =
'回傳 `y/x` 的反正切值(用弧度表示)。'
math.atan2 =
'回傳 `y/x` 的反正切值(用弧度表示)。'
math.ceil =
'回傳不小於 `x` 的最小整數值。'
math.cos =
'回傳 `x` 的餘弦(假定引數是弧度)。'
math.cosh =
'回傳 `x` 的雙曲餘弦(假定引數是弧度)。'
math.deg =
'將角 `x` 從弧度轉換為角度。'
math.exp =
'回傳 `e^x` 的值e 為自然對數的底)。'
math.floor =
'回傳不大於 `x` 的最大整數值。'
math.fmod =
'回傳 `x` 除以 `y`,將商向零捨入後的餘數。'
math.frexp =
'將 `x` 分解為尾數與指數,回傳值符合 `x = m * (2 ^ e)` 。`e` 是一個整數,`m` 是 [0.5, 1) 之間的規格化小數 (`x` 為0時 `m` 為0)。'
math.huge =
'一個比任何數字值都大的浮點數。'
math.ldexp =
'回傳 `m * (2 ^ e)` 。'
math.log['<5.1'] =
'回傳 `x` 的自然對數。'
math.log['>5.2'] =
'回以指定底的 `x` 的對數。'
math.log10 =
'回傳 `x` 的以10為底的對數。'
math.max =
'回傳引數中最大的值,大小由 Lua 運算子 `<` 決定。'
math.maxinteger['>5.3'] =
'最大值的整數。'
math.min =
'回傳引數中最小的值,大小由 Lua 運算子 `<` 決定。'
math.mininteger['>5.3'] =
'最小值的整數。'
math.modf =
'回傳 `x` 的整數部分和小數部分。'
math.pi =
'*π* 的值。'
math.pow =
'回傳 `x ^ y` 。'
math.rad =
'將角 `x` 從角度轉換為弧度。'
math.random =
[[
* `math.random()` [0,1)
* `math.random(n)` [1, n]
* `math.random(m, n)` [m, n]
]]
math.randomseed['<5.3'] =
'把 `x` 設為偽隨機數發生器的“種子”: 相同的種子產生相同的隨機數列。'
math.randomseed['>5.4'] =
[[
* `math.randomseed(x, y)` `x` `y` 128
* `math.randomseed(x)` `math.randomseed(x, 0)`
* `math.randomseed()`
]]
math.sin =
'回傳 `x` 的正弦值(假定引數是弧度)。'
math.sinh =
'回傳 `x` 的雙曲正弦值(假定引數是弧度)。'
math.sqrt =
'回傳 `x` 的平方根。'
math.tan =
'回傳 `x` 的正切值(假定引數是弧度)。'
math.tanh =
'回傳 `x` 的雙曲正切值(假定引數是弧度)。'
math.tointeger['>5.3'] =
'如果 `x` 可以轉換為一個整數,回傳該整數。'
math.type['>5.3'] =
'如果 `x` 是整數,回傳 `"integer"` ,如果它是浮點數,回傳 `"float"` ,如果 `x` 不是數字,回傳 `nil` 。'
math.ult['>5.3'] =
'整數 `m` 和 `n` 以無符號整數形式比較,如果 `m` 在 `n` 之下則回傳布林真,否則回傳假。'
os =
''
os.clock =
'回傳程式使用的 CPU 時間的近似值,單位為秒。'
os.date =
'回傳一個包含日期及時刻的字串或表。格式化方法取決於所給字串 `format` 。'
os.difftime =
'回傳以秒計算的時刻 `t1` 到 `t2` 的差值。'
os.execute =
'呼叫作業系統殼層執行 `command` 。'
os.exit['<5.1'] =
'呼叫 C 函式 `exit` 終止宿主程式。'
os.exit['>5.2'] =
'呼叫 ISO C 函式 `exit` 終止宿主程式。'
os.getenv =
'回傳處理程序環境變數 `varname` 的值。'
os.remove =
'刪除指定名字的檔案。'
os.rename =
'將名字為 `oldname` 的檔案或目錄更名為 `newname`。'
os.setlocale =
'設定程式的目前區域。'
os.time =
'當不傳引數時,回傳目前時刻。如果傳入一張表,就回傳由這張表表示的時刻。'
os.tmpname =
'回傳一個可用於臨時檔案的檔名字串。'
osdate.year =
'四位數字'
osdate.month =
'1-12'
osdate.day =
'1-31'
osdate.hour =
'0-23'
osdate.min =
'0-59'
osdate.sec =
'0-61'
osdate.wday =
'星期幾範圍為1-7星期天為 1'
osdate.yday =
'該年的第幾天範圍為1-366'
osdate.isdst =
'是否為夏令時間,一個布林值'
package =
''
require['<5.3'] =
'載入一個模組,回傳該模組的回傳值( `nil` 時為 `true` )。'
require['>5.4'] =
'載入一個模組,回傳該模組的回傳值( `nil` 時為 `true` )與搜尋器回傳的載入資料。預設搜尋器的載入資料指示了載入位置,對於檔案來説就是檔案路徑。'
package.config =
'一個描述一些為包管理準備的編譯時期組態的字串。'
package.cpath =
'這個路徑被 `require` 在 C 載入器中做搜尋時用到。'
package.loaded =
'用於 `require` 控制哪些模組已經被載入的表。'
package.loaders =
'用於 `require` 控制如何載入模組的表。'
package.loadlib =
'讓宿主程式動態連結 C 庫 `libname` 。'
package.path =
'這個路徑被 `require` 在 Lua 載入器中做搜尋時用到。'
package.preload =
'儲存有一些特殊模組的載入器。'
package.searchers =
'用於 `require` 控制如何載入模組的表。'
package.searchpath =
'在指定 `path` 中搜尋指定的 `name` 。'
package.seeall =
'給 `module` 設定一個中繼資料表,該中繼資料表的 `__index` 域為全域環境,這樣模組便會繼承全域環境的值。可作為 `module` 函式的選項。'
string =
''
string.byte =
'回傳字元 `s[i]` 、 `s[i+1]` ... `s[j]` 的內部數字編碼。'
string.char =
'接收零或更多的整數,回傳和引數數量相同長度的字串。其中每個字元的內部編碼值等於對應的引數值。'
string.dump =
'回傳包含有以二進制方式表示的(一個 *二進制程式碼區塊* )指定函式的字串。'
string.find =
'尋找第一個字串中配對到的 `pattern`(參見 §6.4.1)。'
string.format =
'回傳不定數量引數的格式化版本,格式化字串為第一個引數。'
string.gmatch =
[[
`pattern`  §6.4.1 s
s
```lua
s =
"hello world from Lua"
for w in string.gmatch(s, "%a+") do
print(w)
end
```
]]
string.gsub =
'將字串 s 中,所有的(或是在 n 給出時的前 n 個) `pattern` (參見 §6.4.1)都替換成 `repl` ,並回傳其副本。'
string.len =
'回傳其長度。'
string.lower =
'將其中的大寫字元都轉為小寫後回傳其副本。'
string.match =
'在字串 s 中找到第一個能用 `pattern` (參見 §6.4.1)配對到的部分。如果能找到,回傳其中的捕獲物,否則回傳 `nil` 。'
string.pack =
'回傳一個壓縮了(即以二進制形式序列化) v1, v2 等值的二進制字串。字串 `fmt` 為壓縮格式(參見 §6.4.2)。'
string.packsize =
[[回傳以指定格式用 $string.pack 壓縮的字串的長度。格式化字串中不可以有變長選項 's' 或 'z' (參見 §6.4.2)。]]
string.rep['>5.2'] =
'回傳 `n` 個字串 `s` 以字串 `sep` 為分割符連在一起的字串。預設的 `sep` 值為空字串(即沒有分割符)。如果 `n` 不是正數則回傳空字串。'
string.rep['<5.1'] =
'回傳 `n` 個字串 `s` 連在一起的字串。如果 `n` 不是正數則回傳空字串。'
string.reverse =
'回傳字串 s 的反轉字串。'
string.sub =
'回傳一個從 `i` 開始並在 `j` 結束的子字串。'
string.unpack =
'回傳以格式 `fmt` (參見 §6.4.2 壓縮在字串 `s` (參見 $string.pack 中的值。'
string.upper =
'接收一個字串,將其中的小寫字元都轉為大寫後回傳其副本。'
table =
''
table.concat =
'提供一個列表,其所有元素都是字串或數字,回傳字串 `list[i]..sep..list[i+1] ··· sep..list[j]`。'
table.insert =
'在 `list` 的位置 `pos` 處插入元素 `value`。'
table.maxn =
'回傳給定表的最大正數索引,如果表沒有正數索引,則回傳零。'
table.move =
[[
`a1` `a2`
```lua
a2[t],··· =
a1[f],···,a1[e]
return a2
```
]]
table.pack =
'回傳用所有引數以鍵 `1`,`2`, 等填充的新表,並將 `"n"` 這個域設為引數的總數。'
table.remove =
'移除 `list` 中 `pos` 位置上的元素,並回傳這個被移除的值。'
table.sort =
'在表內從 `list[1]` 到 `list[#list]` *原地* 對其間元素按指定順序排序。'
table.unpack =
[[
```lua
return list[i], list[i+1], ···, list[j]
```
i 1 j #list
]]
table.foreach =
'走訪表中的每一個元素並以key和value執行回呼函式。如果回呼函式回傳一個非nil值則循環終止並且回傳這個值。該函式等同pair(list)比pair(list)更慢。不推薦使用。'
table.foreachi =
'走訪表中的每一個元素並以索引號index和value執行回呼函式。如果回呼函式回傳一個非nil值則循環終止並且回傳這個值。該函式等同ipair(list)比ipair(list)更慢。不推薦使用。'
table.getn =
'回傳表的長度。該函式等價於#list。'
table.new =
[[ C API `lua_createtable()` `narray` `nhash` 使 require
```lua
require("table.new")
```
]]
table.clear =
[[使/使 require
```lua
require("table.clear")
```
]]
utf8 =
''
utf8.char =
'接收零或多個整數,將每個整數轉換成對應的 UTF-8 位元組序列,並回傳這些序列連接到一起的字串。'
utf8.charpattern =
'用於精確配對到一個 UTF-8 位元組序列的模式,它假定處理的對象是一個合法的 UTF-8 字串。'
utf8.codes =
[[
```lua
for p, c in utf8.codes(s) do
body
end
```
`s` `p` `c`
]]
utf8.codepoint =
'以整數形式回傳 `s` 中 從位置 `i` 到 `j` 間(包括兩端)所有字元的編號。'
utf8.len =
'回傳字串 `s` 中 從位置 `i` 到 `j` 間 (包括兩端) UTF-8 字元的個數。'
utf8.offset =
'回傳編碼在 `s` 中的第 `n` 個字元的開始位置(按位元組數)(從位置 `i` 處開始統計)。'

View file

@ -0,0 +1,435 @@
---@diagnostic disable: undefined-global
config.addonManager.enable = -- TODO: need translate!
"Whether the addon manager is enabled or not."
config.runtime.version =
"Lua執行版本。"
config.runtime.path =
[[
使 `require`
`?/init.lua` `require 'myfile'` `{workspace}/myfile/init.lua`
`runtime.pathStrict` `false` `${workspace}/**/myfile/init.lua`
`Lua.workspace.library`
]]
config.runtime.pathStrict =
'啟用後 `runtime.path` 將只搜尋第一層目錄,見 `runtime.path` 的説明。'
config.runtime.special =
[[
`include` `require`
```json
"Lua.runtime.special" : {
"include" : "require"
}
```
]]
config.runtime.unicodeName =
"允許在名字中使用 Unicode 字元。"
config.runtime.nonstandardSymbol =
"支援非標準的符號。請務必確認你的執行環境支援這些符號。"
config.runtime.plugin =
"延伸模組路徑,請查閱[文件](https://luals.github.io/wiki/plugins)瞭解用法。"
config.runtime.pluginArgs = -- TODO: need translate!
"Additional arguments for the plugin."
config.runtime.fileEncoding =
"檔案編碼,選項 `ansi` 只在 `Windows` 平台下有效。"
config.runtime.builtin =
[[
調
* `default`:
* `enable`:
* `disable`:
]]
config.runtime.meta =
'meta檔案的目錄名稱格式'
config.diagnostics.enable =
"啟用診斷。"
config.diagnostics.disable =
"停用的診斷(使用浮框括號內的程式碼)。"
config.diagnostics.globals =
"已定義的全域變數。"
config.diagnostics.severity =
[[
`!` `diagnostics.groupSeverity`
]]
config.diagnostics.neededFileStatus =
[[
* Opened:
* Any:
* None:
`!` `diagnostics.groupFileStatus`
]]
config.diagnostics.groupSeverity =
[[
`Fallback` `diagnostics.severity`
`!`
]]
config.diagnostics.groupFileStatus =
[[
* Opened:
* Any:
* None:
`Fallback` `diagnostics.neededFileStatus`
`!`
]]
config.diagnostics.workspaceEvent = -- TODO: need translate!
"Set the time to trigger workspace diagnostics."
config.diagnostics.workspaceEvent.OnChange = -- TODO: need translate!
"Trigger workspace diagnostics when the file is changed."
config.diagnostics.workspaceEvent.OnSave = -- TODO: need translate!
"Trigger workspace diagnostics when the file is saved."
config.diagnostics.workspaceEvent.None = -- TODO: need translate!
"Disable workspace diagnostics."
config.diagnostics.workspaceDelay =
"進行工作區診斷的延遲(毫秒)。"
config.diagnostics.workspaceRate =
"工作區診斷的執行速率百分比。降低該值會減少CPU使用率但是也會降低工作區診斷的速度。你目前正在編輯的檔案的診斷總是全速完成不受該選項影響。"
config.diagnostics.libraryFiles =
"如何診斷透過 `Lua.workspace.library` 載入的檔案。"
config.diagnostics.libraryFiles.Enable =
"總是診斷這些檔案。"
config.diagnostics.libraryFiles.Opened =
"只有打開這些檔案時才會診斷。"
config.diagnostics.libraryFiles.Disable =
"不診斷這些檔案。"
config.diagnostics.ignoredFiles =
"如何診斷被忽略的檔案。"
config.diagnostics.ignoredFiles.Enable =
"總是診斷這些檔案。"
config.diagnostics.ignoredFiles.Opened =
"只有打開這些檔案時才會診斷。"
config.diagnostics.ignoredFiles.Disable =
"不診斷這些檔案。"
config.diagnostics.disableScheme =
'不診斷使用以下 scheme 的lua檔案。'
config.diagnostics.unusedLocalExclude = -- TODO: need translate!
'Do not diagnose `unused-local` when the variable name matches the following pattern.'
config.workspace.ignoreDir =
"忽略的檔案與目錄(使用 `.gitignore` 語法)。"
config.workspace.ignoreSubmodules =
"忽略子模組。"
config.workspace.useGitIgnore =
"忽略 `.gitignore` 中列舉的檔案。"
config.workspace.maxPreload =
"最大預載入檔案數。"
config.workspace.preloadFileSize =
"預載入時跳過大小大於該值KB的檔案。"
config.workspace.library =
"除了目前工作區以外,還會從哪些目錄中載入檔案。這些目錄中的檔案將被視作外部提供的程式碼庫,部分操作(如重新命名欄位)不會修改這些檔案。"
config.workspace.checkThirdParty =
[[
* OpenResty
* Cocos4.0
* LÖVE
* LÖVR
* skynet
* Jass
]]
config.workspace.userThirdParty =
'在這裡添加私有的第三方庫適應檔案路徑,請參考內建的[組態檔案路徑](https://github.com/LuaLS/lua-language-server/tree/master/meta/3rd)'
config.workspace.supportScheme =
'為以下 `scheme` 的lua檔案提供語言伺服。'
config.completion.enable =
'啟用自動完成。'
config.completion.callSnippet =
'顯示函式呼叫片段。'
config.completion.callSnippet.Disable =
"只顯示 `函式名`。"
config.completion.callSnippet.Both =
"顯示 `函式名` 與 `呼叫片段`。"
config.completion.callSnippet.Replace =
"只顯示 `呼叫片段`。"
config.completion.keywordSnippet =
'顯示關鍵字語法片段。'
config.completion.keywordSnippet.Disable =
"只顯示 `關鍵字`。"
config.completion.keywordSnippet.Both =
"顯示 `關鍵字` 與 `語法片段`。"
config.completion.keywordSnippet.Replace =
"只顯示 `語法片段`。"
config.completion.displayContext =
"預覽建議的相關程式碼片段,可能可以幫助你瞭解這項建議的用法。設定的數字表示程式碼片段的擷取行數,設定為 `0` 可以停用此功能。"
config.completion.workspaceWord =
"顯示的上下文單詞是否包含工作區中其他檔案的內容。"
config.completion.showWord =
"在建議中顯示上下文單詞。"
config.completion.showWord.Enable =
"總是在建議中顯示上下文單詞。"
config.completion.showWord.Fallback =
"無法根據語義提供建議時才顯示上下文單詞。"
config.completion.showWord.Disable =
"不顯示上下文單詞。"
config.completion.autoRequire =
"輸入內容看起來是個檔名時,自動 `require` 此檔案。"
config.completion.showParams =
"在建議列表中顯示函式的參數資訊,函式擁有多個定義時會分開顯示。"
config.completion.requireSeparator =
"`require` 時使用的分隔符。"
config.completion.postfix =
"用於觸發後綴建議的符號。"
config.color.mode =
"著色模式。"
config.color.mode.Semantic =
"語義著色。你可能需要同時將 `editor.semanticHighlighting.enabled` 設定為 `true` 才能生效。"
config.color.mode.SemanticEnhanced =
"增強的語義顏色。類似於`Semantic`,但會進行額外的分析(也會帶來額外的開銷)。"
config.color.mode.Grammar =
"語法著色。"
config.semantic.enable =
"啟用語義著色。你可能需要同時將 `editor.semanticHighlighting.enabled` 設定為 `true` 才能生效。"
config.semantic.variable =
"對變數/欄位/參數進行語義著色。"
config.semantic.annotation =
"對類型註解進行語義著色。"
config.semantic.keyword =
"對關鍵字/字面常數/運算子進行語義著色。只有當你的編輯器無法進行語法著色時才需要啟用此功能。"
config.signatureHelp.enable =
"啟用參數提示。"
config.hover.enable =
"啟用懸浮提示。"
config.hover.viewString =
"懸浮提示檢視字串內容(僅當字面常數包含跳脫字元時)。"
config.hover.viewStringMax =
"懸浮提示檢視字串內容時的最大長度。"
config.hover.viewNumber =
"懸浮提示檢視數字內容(僅當字面常數不是十進制時)。"
config.hover.fieldInfer =
"懸浮提示檢視表時,會對表的每個欄位進行類型推測,當類型推測的用時累計達到該設定值(毫秒)時,將跳過後續欄位的類型推測。"
config.hover.previewFields =
"懸浮提示檢視表時,限制表內欄位的最大預覽數量。"
config.hover.enumsLimit =
"當值對應多個類型時,限制類型的顯示數量。"
config.hover.expandAlias =
[[
`---@alias myType boolean|number` 展開後顯示為 `boolean|number`,否則顯示為 `myType'。
]]
config.develop.enable =
'開發者模式。請勿開啟,會影響效能。'
config.develop.debuggerPort =
'除錯器監聽埠。'
config.develop.debuggerWait =
'除錯器連接之前懸置。'
config.intelliSense.searchDepth =
'設定智慧感知的搜尋深度。增大該值可以增加準確度,但會降低效能。不同的工作區對該設定的容忍度差異較大,請自己調整為合適的值。'
config.intelliSense.fastGlobal =
'在對全域變數進行補全,及檢視 `_G` 的懸浮提示時進行最佳化。這會略微降低類型推測的準確度,但是對於大量使用全域變數的專案會有大幅的效能提升。'
config.window.statusBar =
'在狀態欄顯示延伸模組狀態。'
config.window.progressBar =
'在狀態欄顯示進度條。'
config.hint.enable =
'啟用內嵌提示。'
config.hint.paramType =
'在函式的參數位置提示類型。'
config.hint.setType =
'在賦值操作位置提示類型。'
config.hint.paramName =
'在函式呼叫處提示參數名。'
config.hint.paramName.All =
'所有類型的參數均進行提示。'
config.hint.paramName.Literal =
'只有字面常數類型的參數進行提示。'
config.hint.paramName.Disable =
'停用參數提示。'
config.hint.arrayIndex =
'在建構表時提示陣列索引。'
config.hint.arrayIndex.Enable =
'所有的表中都提示陣列索引。'
config.hint.arrayIndex.Auto =
'只有表大於3項或者表是混合類型時才進行提示。'
config.hint.arrayIndex.Disable =
'停用陣列索引提示。'
config.hint.await =
'如果呼叫的函數被標記為了 `---@async`,則在呼叫處提示 `await`。'
config.hint.semicolon =
'若陳述式尾部沒有分號,則顯示虛擬分號。'
config.hint.semicolon.All =
'所有陳述式都顯示虛擬分號。'
config.hint.semicolon.SameLine =
'兩個陳述式在同一行時,在它們之間顯示分號。'
config.hint.semicolon.Disable =
'停用虛擬分號。'
config.codeLens.enable = -- TODO: need translate!
'Enable code lens.'
config.format.enable =
'啟用程式碼格式化程式。'
config.format.defaultConfig =
[[
`.editorconfig`
[](https://github.com/CppCXY/EmmyLuaCodeStyle/tree/master/docs)
]]
config.spell.dict =
'拼寫檢查的自訂單詞。'
config.nameStyle.config = -- TODO: need translate!
'Set name style config'
config.telemetry.enable =
[[
[](https://luals.github.io/privacy/#language-server)
]]
config.misc.parameters =
'VSCode中啟動語言伺服時的[命令列參數](https://luals.github.io/wiki/usage#arguments)。'
config.misc.executablePath = -- TODO: need translate!
'Specify the executable path in VSCode.'
config.type.castNumberToInteger =
'允許將 `number` 類型賦值給 `integer` 類型。'
config.type.weakUnionCheck =
[[
滿滿
`false` `number|boolean` `number` `true`
]]
config.type.weakNilCheck = -- TODO: need translate!
[[
When checking the type of union type, ignore the `nil` in it.
When this setting is `false`, the `number|nil` type cannot be assigned to the `number` type. It can be with `true`.
]]
config.doc.privateName = -- TODO: need translate!
'Treat specific field names as private, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are private, witch can only be accessed in the class where the definition is located.'
config.doc.protectedName = -- TODO: need translate!
'Treat specific field names as protected, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are protected, witch can only be accessed in the class where the definition is located and its subclasses.'
config.doc.packageName = -- TODO: need translate!
'Treat specific field names as package, e.g. `m_*` means `XXX.m_id` and `XXX.m_type` are package, witch can only be accessed in the file where the definition is located.'
config.diagnostics['unused-local'] =
'未使用的區域變數'
config.diagnostics['unused-function'] =
'未使用的函式'
config.diagnostics['undefined-global'] =
'未定義的全域變數'
config.diagnostics['global-in-nil-env'] =
'不能使用全域變數( `_ENV` 被設定為 `nil`'
config.diagnostics['unused-label'] =
'未使用的標籤'
config.diagnostics['unused-vararg'] =
'未使用的不定引數'
config.diagnostics['trailing-space'] =
'後置空格'
config.diagnostics['redefined-local'] =
'重複定義的區域變數'
config.diagnostics['newline-call'] =
'以 `(` 開始的新行,在語法上被解析為了上一行的函式呼叫'
config.diagnostics['newfield-call'] =
'在字面常數表中2行程式碼之間缺少分隔符在語法上被解析為了一次索引操作'
config.diagnostics['redundant-parameter'] =
'函式呼叫時,傳入了多餘的引數'
config.diagnostics['ambiguity-1'] =
'優先順序歧義,如: `num or 0 + 1` ,推測使用者的實際期望為 `(num or 0) + 1`'
config.diagnostics['lowercase-global'] =
'首字母小寫的全域變數定義'
config.diagnostics['undefined-env-child'] =
'`_ENV` 被設定為了新的字面常數表,但是試圖獲取的全域變數不在這張表中'
config.diagnostics['duplicate-index'] =
'在字面常數表中重複定義了索引'
config.diagnostics['empty-block'] =
'空程式碼區塊'
config.diagnostics['redundant-value'] =
'賦值操作時,值的數量比被賦值的對象多'
config.diagnostics['assign-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for assignments in which the value\'s type does not match the type of the assigned variable.'
config.diagnostics['await-in-sync'] = -- TODO: need translate!
'Enable diagnostics for calls of asynchronous functions within a synchronous function.'
config.diagnostics['cast-local-type'] = -- TODO: need translate!
'Enable diagnostics for casts of local variables where the target type does not match the defined type.'
config.diagnostics['cast-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for casts where the target type does not match the initial type.'
config.diagnostics['circular-doc-class'] = -- TODO: need translate!
'Enable diagnostics for two classes inheriting from each other introducing a circular relation.'
config.diagnostics['close-non-object'] = -- TODO: need translate!
'Enable diagnostics for attempts to close a variable with a non-object.'
config.diagnostics['code-after-break'] = -- TODO: need translate!
'Enable diagnostics for code placed after a break statement in a loop.'
config.diagnostics['codestyle-check'] = -- TODO: need translate!
'Enable diagnostics for incorrectly styled lines.'
config.diagnostics['count-down-loop'] = -- TODO: need translate!
'Enable diagnostics for `for` loops which will never reach their max/limit because the loop is incrementing instead of decrementing.'
config.diagnostics['deprecated'] = -- TODO: need translate!
'Enable diagnostics to highlight deprecated API.'
config.diagnostics['different-requires'] = -- TODO: need translate!
'Enable diagnostics for files which are required by two different paths.'
config.diagnostics['discard-returns'] = -- TODO: need translate!
'Enable diagnostics for calls of functions annotated with `---@nodiscard` where the return values are ignored.'
config.diagnostics['doc-field-no-class'] = -- TODO: need translate!
'Enable diagnostics to highlight a field annotation without a defining class annotation.'
config.diagnostics['duplicate-doc-alias'] = -- TODO: need translate!
'Enable diagnostics for a duplicated alias annotation name.'
config.diagnostics['duplicate-doc-field'] = -- TODO: need translate!
'Enable diagnostics for a duplicated field annotation name.'
config.diagnostics['duplicate-doc-param'] = -- TODO: need translate!
'Enable diagnostics for a duplicated param annotation name.'
config.diagnostics['duplicate-set-field'] = -- TODO: need translate!
'Enable diagnostics for setting the same field in a class more than once.'
config.diagnostics['incomplete-signature-doc'] = -- TODO: need translate!
'Incomplete @param or @return annotations for functions.'
config.diagnostics['invisible'] = -- TODO: need translate!
'Enable diagnostics for accesses to fields which are invisible.'
config.diagnostics['missing-global-doc'] = -- TODO: need translate!
'Missing annotations for globals! Global functions must have a comment and annotations for all parameters and return values.'
config.diagnostics['missing-local-export-doc'] = -- TODO: need translate!
'Missing annotations for exported locals! Exported local functions must have a comment and annotations for all parameters and return values.'
config.diagnostics['missing-parameter'] = -- TODO: need translate!
'Enable diagnostics for function calls where the number of arguments is less than the number of annotated function parameters.'
config.diagnostics['missing-return'] = -- TODO: need translate!
'Enable diagnostics for functions with return annotations which have no return statement.'
config.diagnostics['missing-return-value'] = -- TODO: need translate!
'Enable diagnostics for return statements without values although the containing function declares returns.'
config.diagnostics['need-check-nil'] = -- TODO: need translate!
'Enable diagnostics for variable usages if `nil` or an optional (potentially `nil`) value was assigned to the variable before.'
config.diagnostics['no-unknown'] = -- TODO: need translate!
'Enable diagnostics for cases in which the type cannot be inferred.'
config.diagnostics['not-yieldable'] = -- TODO: need translate!
'Enable diagnostics for calls to `coroutine.yield()` when it is not permitted.'
config.diagnostics['param-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for function calls where the type of a provided parameter does not match the type of the annotated function definition.'
config.diagnostics['redundant-return'] = -- TODO: need translate!
'Enable diagnostics for return statements which are not needed because the function would exit on its own.'
config.diagnostics['redundant-return-value']= -- TODO: need translate!
'Enable diagnostics for return statements which return an extra value which is not specified by a return annotation.'
config.diagnostics['return-type-mismatch'] = -- TODO: need translate!
'Enable diagnostics for return values whose type does not match the type declared in the corresponding return annotation.'
config.diagnostics['spell-check'] = -- TODO: need translate!
'Enable diagnostics for typos in strings.'
config.diagnostics['name-style-check'] = -- TODO: need translate!
'Enable diagnostics for name style.'
config.diagnostics['unbalanced-assignments']= -- TODO: need translate!
'Enable diagnostics on multiple assignments if not all variables obtain a value (e.g., `local x,y = 1`).'
config.diagnostics['undefined-doc-class'] = -- TODO: need translate!
'Enable diagnostics for class annotations in which an undefined class is referenced.'
config.diagnostics['undefined-doc-name'] = -- TODO: need translate!
'Enable diagnostics for type annotations referencing an undefined type or alias.'
config.diagnostics['undefined-doc-param'] = -- TODO: need translate!
'Enable diagnostics for cases in which a parameter annotation is given without declaring the parameter in the function definition.'
config.diagnostics['undefined-field'] = -- TODO: need translate!
'Enable diagnostics for cases in which an undefined field of a variable is read.'
config.diagnostics['unknown-cast-variable'] = -- TODO: need translate!
'Enable diagnostics for casts of undefined variables.'
config.diagnostics['unknown-diag-code'] = -- TODO: need translate!
'Enable diagnostics in cases in which an unknown diagnostics code is entered.'
config.diagnostics['unknown-operator'] = -- TODO: need translate!
'Enable diagnostics for unknown operators.'
config.diagnostics['unreachable-code'] = -- TODO: need translate!
'Enable diagnostics for unreachable code.'
config.diagnostics['global-element'] = -- TODO: need translate!
'Enable diagnostics to warn about global elements.'
config.typeFormat.config = -- TODO: need translate!
'Configures the formatting behavior while typing Lua code.'
config.typeFormat.config.auto_complete_end = -- TODO: need translate!
'Controls if `end` is automatically completed at suitable positions.'
config.typeFormat.config.auto_complete_table_sep = -- TODO: need translate!
'Controls if a separator is automatically appended at the end of a table declaration.'
config.typeFormat.config.format_line = -- TODO: need translate!
'Controls if a line is formatted at all.'
command.exportDocument = -- TODO: need translate!
'Lua: Export Document ...'
command.addon_manager.open = -- TODO: need translate!
'Lua: Open Addon Manager ...'
command.reloadFFIMeta = -- TODO: need translate!
'Lua: Reload luajit ffi meta'

View file

@ -0,0 +1,80 @@
local fs = require 'bee.filesystem'
local util = require 'utility'
local version = require 'version'
local function getValue(value)
if value == 'true' or value == nil then
value = true
elseif value == 'false' then
value = false
elseif tonumber(value) then
value = tonumber(value)
elseif value:sub(1, 1) == '"' and value:sub(-1, -1) == '"' then
value = value:sub(2, -2)
end
return value
end
local function loadArgs()
---@type string?
local lastKey
for _, v in ipairs(arg) do
---@type string?
local key, tail = v:match '^%-%-([%w_]+)(.*)$'
local value
if key then
value = tail:match '=(.+)'
lastKey = nil
if not value then
lastKey = key
end
else
if lastKey then
key = lastKey
value = v
lastKey = nil
end
end
if key then
_G[key:upper():gsub('-', '_')] = getValue(value)
end
end
end
loadArgs()
local currentPath = debug.getinfo(1, 'S').source:sub(2)
local rootPath = currentPath:gsub('[/\\]*[^/\\]-$', '')
rootPath = (rootPath == '' and '.' or rootPath)
ROOT = fs.path(util.expandPath(rootPath))
LOGPATH = LOGPATH and util.expandPath(LOGPATH) or (ROOT:string() .. '/log')
METAPATH = METAPATH and util.expandPath(METAPATH) or (ROOT:string() .. '/meta')
---@diagnostic disable-next-line: deprecated
debug.setcstacklimit(200)
collectgarbage('generational', 10, 50)
--collectgarbage('incremental', 120, 120, 0)
---@diagnostic disable-next-line: lowercase-global
log = require 'log'
log.init(ROOT, fs.path(LOGPATH) / 'service.log')
if LOGLEVEL then
log.level = tostring(LOGLEVEL):lower()
end
log.info('Lua Lsp startup, root: ', ROOT)
log.info('ROOT:', ROOT:string())
log.info('LOGPATH:', LOGPATH)
log.info('METAPATH:', METAPATH)
log.info('VERSION:', version.getVersion())
require 'tracy'
xpcall(dofile, log.debug, (ROOT / 'debugger.lua'):string())
require 'cli'
local _, service = xpcall(require, log.error, 'service')
service.start()

View file

@ -0,0 +1,7 @@
{
"name": "Cocos",
"files": ["cocos"],
"settings": {
"Lua.runtime.version": "LuaJIT"
}
}

View file

@ -0,0 +1,81 @@
---@meta
---@class cc.Action :cc.Ref
local Action = {}
cc.Action = Action
---* Called before the action start. It will also set the target. <br>
---* param target A certain target.
---@param target cc.Node
---@return self
function Action:startWithTarget(target) end
---* Set the original target, since target can be nil.<br>
---* Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method.<br>
---* The target is 'assigned', it is not 'retained'.<br>
---* since v0.8.2<br>
---* param originalTarget Is 'assigned', it is not 'retained'.
---@param originalTarget cc.Node
---@return self
function Action:setOriginalTarget(originalTarget) end
---* Returns a clone of action.<br>
---* return A clone action.
---@return self
function Action:clone() end
---* Return a original Target. <br>
---* return A original Target.
---@return cc.Node
function Action:getOriginalTarget() end
---* Called after the action has finished. It will set the 'target' to nil.<br>
---* IMPORTANT: You should never call "Action::stop()" manually. Instead, use: "target->stopAction(action);".
---@return self
function Action:stop() end
---* Called once per frame. time a value between 0 and 1.<br>
---* For example:<br>
---* - 0 Means that the action just started.<br>
---* - 0.5 Means that the action is in the middle.<br>
---* - 1 Means that the action is over.<br>
---* param time A value between 0 and 1.
---@param time float
---@return self
function Action:update(time) end
---* Return certain target.<br>
---* return A certain target.
---@return cc.Node
function Action:getTarget() end
---* Returns a flag field that is used to group the actions easily.<br>
---* return A tag.
---@return unsigned_int
function Action:getFlags() end
---* Called every frame with it's delta time, dt in seconds. DON'T override unless you know what you are doing. <br>
---* param dt In seconds.
---@param dt float
---@return self
function Action:step(dt) end
---* Changes the tag that is used to identify the action easily. <br>
---* param tag Used to identify the action easily.
---@param tag int
---@return self
function Action:setTag(tag) end
---* Changes the flag field that is used to group the actions easily.<br>
---* param flags Used to group the actions easily.
---@param flags unsigned_int
---@return self
function Action:setFlags(flags) end
---* Returns a tag that is used to identify the action easily. <br>
---* return A tag.
---@return int
function Action:getTag() end
---* The action will modify the target properties. <br>
---* param target A certain target.
---@param target cc.Node
---@return self
function Action:setTarget(target) end
---* Return true if the action has finished. <br>
---* return Is true if the action has finished.
---@return boolean
function Action:isDone() end
---* Returns a new action that performs the exact reverse of the action. <br>
---* return A new action that performs the exact reverse of the action.<br>
---* js NA
---@return self
function Action:reverse() end

View file

@ -0,0 +1,44 @@
---@meta
---@class cc.ActionCamera :cc.ActionInterval
local ActionCamera = {}
cc.ActionCamera = ActionCamera
---@overload fun(float:float,float:float,float:float):self
---@overload fun(float0:vec3_table):self
---@param x float
---@param y float
---@param z float
---@return self
function ActionCamera:setEye(x, y, z) end
---*
---@return vec3_table
function ActionCamera:getEye() end
---*
---@param up vec3_table
---@return self
function ActionCamera:setUp(up) end
---*
---@return vec3_table
function ActionCamera:getCenter() end
---*
---@param center vec3_table
---@return self
function ActionCamera:setCenter(center) end
---*
---@return vec3_table
function ActionCamera:getUp() end
---*
---@param target cc.Node
---@return self
function ActionCamera:startWithTarget(target) end
---*
---@return self
function ActionCamera:clone() end
---*
---@return self
function ActionCamera:reverse() end
---* js ctor<br>
---* lua new
---@return self
function ActionCamera:ActionCamera() end

View file

@ -0,0 +1,26 @@
---@meta
---@class cc.ActionEase :cc.ActionInterval
local ActionEase = {}
cc.ActionEase = ActionEase
---* brief Initializes the action.<br>
---* return Return true when the initialization success, otherwise return false.
---@param action cc.ActionInterval
---@return boolean
function ActionEase:initWithAction(action) end
---* brief Get the pointer of the inner action.<br>
---* return The pointer of the inner action.
---@return cc.ActionInterval
function ActionEase:getInnerAction() end
---*
---@param target cc.Node
---@return self
function ActionEase:startWithTarget(target) end
---*
---@return self
function ActionEase:stop() end
---*
---@param time float
---@return self
function ActionEase:update(time) end

View file

@ -0,0 +1,43 @@
---@meta
---@class cc.ActionFloat :cc.ActionInterval
local ActionFloat = {}
cc.ActionFloat = ActionFloat
---*
---@param duration float
---@param from float
---@param to float
---@param callback function
---@return boolean
function ActionFloat:initWithDuration(duration, from, to, callback) end
---* Creates FloatAction with specified duration, from value, to value and callback to report back<br>
---* results<br>
---* param duration of the action<br>
---* param from value to start from<br>
---* param to value to be at the end of the action<br>
---* param callback to report back result<br>
---* return An autoreleased ActionFloat object
---@param duration float
---@param from float
---@param to float
---@param callback function
---@return self
function ActionFloat:create(duration, from, to, callback) end
---* Overridden ActionInterval methods
---@param target cc.Node
---@return self
function ActionFloat:startWithTarget(target) end
---*
---@return self
function ActionFloat:clone() end
---*
---@param delta float
---@return self
function ActionFloat:update(delta) end
---*
---@return self
function ActionFloat:reverse() end
---*
---@return self
function ActionFloat:ActionFloat() end

View file

@ -0,0 +1,27 @@
---@meta
---@class cc.ActionInstant :cc.FiniteTimeAction
local ActionInstant = {}
cc.ActionInstant = ActionInstant
---*
---@param target cc.Node
---@return self
function ActionInstant:startWithTarget(target) end
---*
---@return self
function ActionInstant:reverse() end
---*
---@return self
function ActionInstant:clone() end
---* param time In seconds.
---@param time float
---@return self
function ActionInstant:update(time) end
---* param dt In seconds.
---@param dt float
---@return self
function ActionInstant:step(dt) end
---*
---@return boolean
function ActionInstant:isDone() end

View file

@ -0,0 +1,40 @@
---@meta
---@class cc.ActionInterval :cc.FiniteTimeAction
local ActionInterval = {}
cc.ActionInterval = ActionInterval
---* Gets the amplitude rate, extension in GridAction<br>
---* return The amplitude rate.
---@return float
function ActionInterval:getAmplitudeRate() end
---* initializes the action
---@param d float
---@return boolean
function ActionInterval:initWithDuration(d) end
---* Sets the amplitude rate, extension in GridAction<br>
---* param amp The amplitude rate.
---@param amp float
---@return self
function ActionInterval:setAmplitudeRate(amp) end
---* How many seconds had elapsed since the actions started to run.<br>
---* return The seconds had elapsed since the actions started to run.
---@return float
function ActionInterval:getElapsed() end
---*
---@param target cc.Node
---@return self
function ActionInterval:startWithTarget(target) end
---* param dt in seconds
---@param dt float
---@return self
function ActionInterval:step(dt) end
---*
---@return self
function ActionInterval:clone() end
---*
---@return self
function ActionInterval:reverse() end
---*
---@return boolean
function ActionInterval:isDone() end

View file

@ -0,0 +1,121 @@
---@meta
---@class cc.ActionManager :cc.Ref
local ActionManager = {}
cc.ActionManager = ActionManager
---* Gets an action given its tag an a target.<br>
---* param tag The action's tag.<br>
---* param target A certain target.<br>
---* return The Action the with the given tag.
---@param tag int
---@param target cc.Node
---@return cc.Action
function ActionManager:getActionByTag(tag, target) end
---* Removes an action given its tag and the target.<br>
---* param tag The action's tag.<br>
---* param target A certain target.
---@param tag int
---@param target cc.Node
---@return self
function ActionManager:removeActionByTag(tag, target) end
---* Removes all actions matching at least one bit in flags and the target.<br>
---* param flags The flag field to match the actions' flags based on bitwise AND.<br>
---* param target A certain target.<br>
---* js NA
---@param flags unsigned_int
---@param target cc.Node
---@return self
function ActionManager:removeActionsByFlags(flags, target) end
---* Removes all actions from all the targets.
---@return self
function ActionManager:removeAllActions() end
---* Adds an action with a target. <br>
---* If the target is already present, then the action will be added to the existing target.<br>
---* If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target.<br>
---* When the target is paused, the queued actions won't be 'ticked'.<br>
---* param action A certain action.<br>
---* param target The target which need to be added an action.<br>
---* param paused Is the target paused or not.
---@param action cc.Action
---@param target cc.Node
---@param paused boolean
---@return self
function ActionManager:addAction(action, target, paused) end
---* Resumes the target. All queued actions will be resumed.<br>
---* param target A certain target.
---@param target cc.Node
---@return self
function ActionManager:resumeTarget(target) end
---* Returns the numbers of actions that are running in all targets.<br>
---* return The numbers of actions that are running in all target.<br>
---* js NA
---@return int
function ActionManager:getNumberOfRunningActions() end
---* Pauses the target: all running actions and newly added actions will be paused.<br>
---* param target A certain target.
---@param target cc.Node
---@return self
function ActionManager:pauseTarget(target) end
---* Returns the numbers of actions that are running in a certain target. <br>
---* Composable actions are counted as 1 action. Example:<br>
---* - If you are running 1 Sequence of 7 actions, it will return 1.<br>
---* - If you are running 7 Sequences of 2 actions, it will return 7.<br>
---* param target A certain target.<br>
---* return The numbers of actions that are running in a certain target.<br>
---* js NA
---@param target cc.Node
---@return int
function ActionManager:getNumberOfRunningActionsInTarget(target) end
---* Removes all actions from a certain target.<br>
---* All the actions that belongs to the target will be removed.<br>
---* param target A certain target.
---@param target cc.Node
---@return self
function ActionManager:removeAllActionsFromTarget(target) end
---* Resume a set of targets (convenience function to reverse a pauseAllRunningActions call).<br>
---* param targetsToResume A set of targets need to be resumed.
---@param targetsToResume array_table
---@return self
function ActionManager:resumeTargets(targetsToResume) end
---* Removes an action given an action reference.<br>
---* param action A certain target.
---@param action cc.Action
---@return self
function ActionManager:removeAction(action) end
---* Pauses all running actions, returning a list of targets whose actions were paused.<br>
---* return A list of targets whose actions were paused.
---@return array_table
function ActionManager:pauseAllRunningActions() end
---* Main loop of ActionManager.<br>
---* param dt In seconds.
---@param dt float
---@return self
function ActionManager:update(dt) end
---* Removes all actions given its tag and the target.<br>
---* param tag The actions' tag.<br>
---* param target A certain target.<br>
---* js NA
---@param tag int
---@param target cc.Node
---@return self
function ActionManager:removeAllActionsByTag(tag, target) end
---* Returns the numbers of actions that are running in a<br>
---* certain target with a specific tag.<br>
---* Like getNumberOfRunningActionsInTarget Composable actions<br>
---* are counted as 1 action. Example:<br>
---* - If you are running 1 Sequence of 7 actions, it will return 1.<br>
---* - If you are running 7 Sequences of 2 actions, it will return 7.<br>
---* param target A certain target.<br>
---* param tag Tag that will be searched.<br>
---* return The numbers of actions that are running in a certain target<br>
---* with a specific tag.<br>
---* see getNumberOfRunningActionsInTarget<br>
---* js NA
---@param target cc.Node
---@param tag int
---@return unsigned_int
function ActionManager:getNumberOfRunningActionsInTargetByTag(target, tag) end
---* js ctor
---@return self
function ActionManager:ActionManager() end

View file

@ -0,0 +1,44 @@
---@meta
---@class cc.ActionTween :cc.ActionInterval
local ActionTween = {}
cc.ActionTween = ActionTween
---* brief Initializes the action with the property name (key), and the from and to parameters.<br>
---* param duration The duration of the ActionTween. It's a value in seconds.<br>
---* param key The key of property which should be updated.<br>
---* param from The value of the specified property when the action begin.<br>
---* param to The value of the specified property when the action end.<br>
---* return If the initialization success, return true; otherwise, return false.
---@param duration float
---@param key string
---@param from float
---@param to float
---@return boolean
function ActionTween:initWithDuration(duration, key, from, to) end
---* brief Create and initializes the action with the property name (key), and the from and to parameters.<br>
---* param duration The duration of the ActionTween. It's a value in seconds.<br>
---* param key The key of property which should be updated.<br>
---* param from The value of the specified property when the action begin.<br>
---* param to The value of the specified property when the action end.<br>
---* return If the creation success, return a pointer of ActionTween; otherwise, return nil.
---@param duration float
---@param key string
---@param from float
---@param to float
---@return self
function ActionTween:create(duration, key, from, to) end
---*
---@param target cc.Node
---@return self
function ActionTween:startWithTarget(target) end
---*
---@return self
function ActionTween:clone() end
---*
---@param dt float
---@return self
function ActionTween:update(dt) end
---*
---@return self
function ActionTween:reverse() end

View file

@ -0,0 +1,18 @@
---@meta
---@class cc.AmbientLight :cc.BaseLight
local AmbientLight = {}
cc.AmbientLight = AmbientLight
---* Creates a ambient light.<br>
---* param color The light's color.<br>
---* return The new ambient light.
---@param color color3b_table
---@return self
function AmbientLight:create(color) end
---*
---@return int
function AmbientLight:getLightType() end
---*
---@return self
function AmbientLight:AmbientLight() end

View file

@ -0,0 +1,49 @@
---@meta
---@class cc.Animate :cc.ActionInterval
local Animate = {}
cc.Animate = Animate
---* initializes the action with an Animation and will restore the original frame when the animation is over
---@param animation cc.Animation
---@return boolean
function Animate:initWithAnimation(animation) end
---@overload fun():self
---@overload fun():self
---@return cc.Animation
function Animate:getAnimation() end
---* Gets the index of sprite frame currently displayed.<br>
---* return int the index of sprite frame currently displayed.
---@return int
function Animate:getCurrentFrameIndex() end
---* Sets the Animation object to be animated <br>
---* param animation certain animation.
---@param animation cc.Animation
---@return self
function Animate:setAnimation(animation) end
---* Creates the action with an Animation and will restore the original frame when the animation is over.<br>
---* param animation A certain animation.<br>
---* return An autoreleased Animate object.
---@param animation cc.Animation
---@return self
function Animate:create(animation) end
---*
---@param target cc.Node
---@return self
function Animate:startWithTarget(target) end
---*
---@return self
function Animate:clone() end
---*
---@return self
function Animate:stop() end
---*
---@return self
function Animate:reverse() end
---* param t In seconds.
---@param t float
---@return self
function Animate:update(t) end
---*
---@return self
function Animate:Animate() end

View file

@ -0,0 +1,106 @@
---@meta
---@class cc.Animate3D :cc.ActionInterval
local Animate3D = {}
cc.Animate3D = Animate3D
---*
---@param keyFrame int
---@param userInfo map_table
---@return self
function Animate3D:setKeyFrameUserInfo(keyFrame, userInfo) end
---* get & set speed, negative speed means playing reverse
---@return float
function Animate3D:getSpeed() end
---* set animate quality
---@param quality int
---@return self
function Animate3D:setQuality(quality) end
---*
---@param weight float
---@return self
function Animate3D:setWeight(weight) end
---*
---@return self
function Animate3D:removeFromMap() end
---*
---@param animation cc.Animation3D
---@param startFrame int
---@param endFrame int
---@param frameRate float
---@return boolean
function Animate3D:initWithFrames(animation, startFrame, endFrame, frameRate) end
---*
---@return float
function Animate3D:getOriginInterval() end
---*
---@param speed float
---@return self
function Animate3D:setSpeed(speed) end
---@overload fun(cc.Animation3D:cc.Animation3D,float:float,float:float):self
---@overload fun(cc.Animation3D:cc.Animation3D):self
---@param animation cc.Animation3D
---@param fromTime float
---@param duration float
---@return boolean
function Animate3D:init(animation, fromTime, duration) end
---* get & set origin interval
---@param interval float
---@return self
function Animate3D:setOriginInterval(interval) end
---* get & set blend weight, weight must positive
---@return float
function Animate3D:getWeight() end
---* get animate quality
---@return int
function Animate3D:getQuality() end
---@overload fun(cc.Animation3D:cc.Animation3D,float:float,float:float):self
---@overload fun(cc.Animation3D:cc.Animation3D):self
---@param animation cc.Animation3D
---@param fromTime float
---@param duration float
---@return self
function Animate3D:create(animation, fromTime, duration) end
---* get animate transition time between 3d animations
---@return float
function Animate3D:getTransitionTime() end
---* create Animate3D by frame section, [startFrame, endFrame)<br>
---* param animation used to generate animate3D<br>
---* param startFrame<br>
---* param endFrame<br>
---* param frameRate default is 30 per second<br>
---* return Animate3D created using animate
---@param animation cc.Animation3D
---@param startFrame int
---@param endFrame int
---@param frameRate float
---@return self
function Animate3D:createWithFrames(animation, startFrame, endFrame, frameRate) end
---* set animate transition time between 3d animations
---@param transTime float
---@return self
function Animate3D:setTransitionTime(transTime) end
---*
---@param target cc.Node
---@return self
function Animate3D:startWithTarget(target) end
---*
---@return self
function Animate3D:reverse() end
---*
---@return self
function Animate3D:clone() end
---*
---@return self
function Animate3D:stop() end
---*
---@param t float
---@return self
function Animate3D:update(t) end
---*
---@param dt float
---@return self
function Animate3D:step(dt) end
---*
---@return self
function Animate3D:Animate3D() end

View file

@ -0,0 +1,107 @@
---@meta
---@class cc.Animation :cc.Ref
local Animation = {}
cc.Animation = Animation
---* Gets the times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ... <br>
---* return The times the animation is going to loop.
---@return unsigned_int
function Animation:getLoops() end
---* Adds a SpriteFrame to a Animation.<br>
---* param frame The frame will be added with one "delay unit".
---@param frame cc.SpriteFrame
---@return self
function Animation:addSpriteFrame(frame) end
---* Sets whether to restore the original frame when animation finishes. <br>
---* param restoreOriginalFrame Whether to restore the original frame when animation finishes.
---@param restoreOriginalFrame boolean
---@return self
function Animation:setRestoreOriginalFrame(restoreOriginalFrame) end
---*
---@return self
function Animation:clone() end
---* Gets the duration in seconds of the whole animation. It is the result of totalDelayUnits * delayPerUnit.<br>
---* return Result of totalDelayUnits * delayPerUnit.
---@return float
function Animation:getDuration() end
---* Initializes a Animation with AnimationFrame.<br>
---* since v2.0
---@param arrayOfAnimationFrameNames array_table
---@param delayPerUnit float
---@param loops unsigned_int
---@return boolean
function Animation:initWithAnimationFrames(arrayOfAnimationFrameNames, delayPerUnit, loops) end
---* Initializes a Animation.
---@return boolean
function Animation:init() end
---* Sets the array of AnimationFrames. <br>
---* param frames The array of AnimationFrames.
---@param frames array_table
---@return self
function Animation:setFrames(frames) end
---* Gets the array of AnimationFrames.<br>
---* return The array of AnimationFrames.
---@return array_table
function Animation:getFrames() end
---* Sets the times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ... <br>
---* param loops The times the animation is going to loop.
---@param loops unsigned_int
---@return self
function Animation:setLoops(loops) end
---* Sets the delay in seconds of the "delay unit".<br>
---* param delayPerUnit The delay in seconds of the "delay unit".
---@param delayPerUnit float
---@return self
function Animation:setDelayPerUnit(delayPerUnit) end
---* Adds a frame with an image filename. Internally it will create a SpriteFrame and it will add it.<br>
---* The frame will be added with one "delay unit".<br>
---* Added to facilitate the migration from v0.8 to v0.9.<br>
---* param filename The path of SpriteFrame.
---@param filename string
---@return self
function Animation:addSpriteFrameWithFile(filename) end
---* Gets the total Delay units of the Animation. <br>
---* return The total Delay units of the Animation.
---@return float
function Animation:getTotalDelayUnits() end
---* Gets the delay in seconds of the "delay unit".<br>
---* return The delay in seconds of the "delay unit".
---@return float
function Animation:getDelayPerUnit() end
---* Initializes a Animation with frames and a delay between frames.<br>
---* since v0.99.5
---@param arrayOfSpriteFrameNames array_table
---@param delay float
---@param loops unsigned_int
---@return boolean
function Animation:initWithSpriteFrames(arrayOfSpriteFrameNames, delay, loops) end
---* Checks whether to restore the original frame when animation finishes. <br>
---* return Restore the original frame when animation finishes.
---@return boolean
function Animation:getRestoreOriginalFrame() end
---* Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.<br>
---* The frame will be added with one "delay unit".<br>
---* Added to facilitate the migration from v0.8 to v0.9.<br>
---* param pobTexture A frame with a texture.<br>
---* param rect The Texture of rect.
---@param pobTexture cc.Texture2D
---@param rect rect_table
---@return self
function Animation:addSpriteFrameWithTexture(pobTexture, rect) end
---@overload fun(array_table:array_table,float:float,unsigned_int:unsigned_int):self
---@overload fun():self
---@param arrayOfAnimationFrameNames array_table
---@param delayPerUnit float
---@param loops unsigned_int
---@return self
function Animation:create(arrayOfAnimationFrameNames, delayPerUnit, loops) end
---*
---@param arrayOfSpriteFrameNames array_table
---@param delay float
---@param loops unsigned_int
---@return self
function Animation:createWithSpriteFrames(arrayOfSpriteFrameNames, delay, loops) end
---*
---@return self
function Animation:Animation() end

View file

@ -0,0 +1,26 @@
---@meta
---@class cc.Animation3D :cc.Ref
local Animation3D = {}
cc.Animation3D = Animation3D
---* init Animation3D with file name and animation name
---@param filename string
---@param animationName string
---@return boolean
function Animation3D:initWithFile(filename, animationName) end
---* init Animation3D from bundle data
---@param data cc.Animation3DData
---@return boolean
function Animation3D:init(data) end
---* get duration
---@return float
function Animation3D:getDuration() end
---* read all animation or only the animation with given animationName? animationName == "" read the first.
---@param filename string
---@param animationName string
---@return self
function Animation3D:create(filename, animationName) end
---*
---@return self
function Animation3D:Animation3D() end

View file

@ -0,0 +1,58 @@
---@meta
---@class cc.AnimationCache :cc.Ref
local AnimationCache = {}
cc.AnimationCache = AnimationCache
---* Returns a Animation that was previously added.<br>
---* If the name is not found it will return nil.<br>
---* You should retain the returned copy if you are going to use it.<br>
---* return A Animation that was previously added. If the name is not found it will return nil.
---@param name string
---@return cc.Animation
function AnimationCache:getAnimation(name) end
---* Adds a Animation with a name.<br>
---* param animation An animation.<br>
---* param name The name of animation.
---@param animation cc.Animation
---@param name string
---@return self
function AnimationCache:addAnimation(animation, name) end
---*
---@return boolean
function AnimationCache:init() end
---* Adds an animation from an NSDictionary.<br>
---* Make sure that the frames were previously loaded in the SpriteFrameCache.<br>
---* param dictionary An NSDictionary.<br>
---* param plist The path of the relative file,it use to find the plist path for load SpriteFrames.<br>
---* since v1.1<br>
---* js NA
---@param dictionary map_table
---@param plist string
---@return self
function AnimationCache:addAnimationsWithDictionary(dictionary, plist) end
---* Deletes a Animation from the cache.<br>
---* param name The name of animation.
---@param name string
---@return self
function AnimationCache:removeAnimation(name) end
---* Adds an animation from a plist file.<br>
---* Make sure that the frames were previously loaded in the SpriteFrameCache.<br>
---* since v1.1<br>
---* js addAnimations<br>
---* lua addAnimations<br>
---* param plist An animation from a plist file.
---@param plist string
---@return self
function AnimationCache:addAnimationsWithFile(plist) end
---* Purges the cache. It releases all the Animation objects and the shared instance.<br>
---* js NA
---@return self
function AnimationCache:destroyInstance() end
---* Returns the shared instance of the Animation cache <br>
---* js NA
---@return self
function AnimationCache:getInstance() end
---* js ctor
---@return self
function AnimationCache:AnimationCache() end

View file

@ -0,0 +1,55 @@
---@meta
---@class cc.AnimationFrame :cc.Ref
local AnimationFrame = {}
cc.AnimationFrame = AnimationFrame
---* Set the SpriteFrame.<br>
---* param frame A SpriteFrame will be used.
---@param frame cc.SpriteFrame
---@return self
function AnimationFrame:setSpriteFrame(frame) end
---@overload fun():self
---@overload fun():self
---@return map_table
function AnimationFrame:getUserInfo() end
---* Sets the units of time the frame takes.<br>
---* param delayUnits The units of time the frame takes.
---@param delayUnits float
---@return self
function AnimationFrame:setDelayUnits(delayUnits) end
---*
---@return self
function AnimationFrame:clone() end
---* Return a SpriteFrameName to be used.<br>
---* return a SpriteFrameName to be used.
---@return cc.SpriteFrame
function AnimationFrame:getSpriteFrame() end
---* Gets the units of time the frame takes.<br>
---* return The units of time the frame takes.
---@return float
function AnimationFrame:getDelayUnits() end
---* Sets user information.<br>
---* param userInfo A dictionary as UserInfo.
---@param userInfo map_table
---@return self
function AnimationFrame:setUserInfo(userInfo) end
---* initializes the animation frame with a spriteframe, number of delay units and a notification user info
---@param spriteFrame cc.SpriteFrame
---@param delayUnits float
---@param userInfo map_table
---@return boolean
function AnimationFrame:initWithSpriteFrame(spriteFrame, delayUnits, userInfo) end
---* Creates the animation frame with a spriteframe, number of delay units and a notification user info.<br>
---* param spriteFrame The animation frame with a spriteframe.<br>
---* param delayUnits Number of delay units.<br>
---* param userInfo A notification user info.<br>
---* since 3.0
---@param spriteFrame cc.SpriteFrame
---@param delayUnits float
---@param userInfo map_table
---@return self
function AnimationFrame:create(spriteFrame, delayUnits, userInfo) end
---* js ctor
---@return self
function AnimationFrame:AnimationFrame() end

View file

@ -0,0 +1,35 @@
---@meta
---@class cc.Application
local Application = {}
cc.Application = Application
---* brief Get target platform
---@return int
function Application:getTargetPlatform() end
---* brief Get current language config<br>
---* return Current language config
---@return int
function Application:getCurrentLanguage() end
---* brief Get current language iso 639-1 code<br>
---* return Current language iso 639-1 code
---@return char
function Application:getCurrentLanguageCode() end
---* brief Open url in default browser<br>
---* param String with url to open.<br>
---* return true if the resource located by the URL was successfully opened; otherwise false.
---@param url string
---@return boolean
function Application:openURL(url) end
---* brief Get application version.
---@return string
function Application:getVersion() end
---* brief Callback by Director to limit FPS.<br>
---* param interval The time, expressed in seconds, between current frame and next.
---@param interval float
---@return self
function Application:setAnimationInterval(interval) end
---* brief Get current application instance.<br>
---* return Current application instance pointer.
---@return self
function Application:getInstance() end

View file

@ -0,0 +1,66 @@
---@meta
---@class cc.AssetsManager :cc.Node
local AssetsManager = {}
cc.AssetsManager = AssetsManager
---*
---@param storagePath char
---@return self
function AssetsManager:setStoragePath(storagePath) end
---*
---@param packageUrl char
---@return self
function AssetsManager:setPackageUrl(packageUrl) end
---*
---@return boolean
function AssetsManager:checkUpdate() end
---*
---@return char
function AssetsManager:getStoragePath() end
---*
---@return self
function AssetsManager:update() end
---* @brief Sets connection time out in seconds
---@param timeout unsigned_int
---@return self
function AssetsManager:setConnectionTimeout(timeout) end
---*
---@param versionFileUrl char
---@return self
function AssetsManager:setVersionFileUrl(versionFileUrl) end
---*
---@return char
function AssetsManager:getPackageUrl() end
---* @brief Gets connection time out in seconds
---@return unsigned_int
function AssetsManager:getConnectionTimeout() end
---*
---@return string
function AssetsManager:getVersion() end
---*
---@return char
function AssetsManager:getVersionFileUrl() end
---*
---@return self
function AssetsManager:deleteVersion() end
---*
---@param packageUrl char
---@param versionFileUrl char
---@param storagePath char
---@param errorCallback function
---@param progressCallback function
---@param successCallback function
---@return self
function AssetsManager:create(
packageUrl,
versionFileUrl,
storagePath,
errorCallback,
progressCallback,
successCallback
)
end
---*
---@return self
function AssetsManager:AssetsManager() end

View file

@ -0,0 +1,60 @@
---@meta
---@class cc.AssetsManagerEx :cc.Ref
local AssetsManagerEx = {}
cc.AssetsManagerEx = AssetsManagerEx
---* @brief Gets the current update state.
---@return int
function AssetsManagerEx:getState() end
---* @brief Function for retrieving the max concurrent task count
---@return int
function AssetsManagerEx:getMaxConcurrentTask() end
---* @brief Check out if there is a new version of manifest.<br>
---* You may use this method before updating, then let user determine whether<br>
---* he wants to update resources.
---@return self
function AssetsManagerEx:checkUpdate() end
---* @brief Set the verification function for checking whether downloaded asset is correct, e.g. using md5 verification<br>
---* param callback The verify callback function
---@param callback function
---@return self
function AssetsManagerEx:setVerifyCallback(callback) end
---* @brief Gets storage path.
---@return string
function AssetsManagerEx:getStoragePath() end
---* @brief Update with the current local manifest.
---@return self
function AssetsManagerEx:update() end
---* @brief Set the handle function for comparing manifests versions<br>
---* param handle The compare function
---@param handle function
---@return self
function AssetsManagerEx:setVersionCompareHandle(handle) end
---* @brief Function for setting the max concurrent task count
---@param max int
---@return self
function AssetsManagerEx:setMaxConcurrentTask(max) end
---* @brief Function for retrieving the local manifest object
---@return cc.Manifest
function AssetsManagerEx:getLocalManifest() end
---* @brief Function for retrieving the remote manifest object
---@return cc.Manifest
function AssetsManagerEx:getRemoteManifest() end
---* @brief Reupdate all failed assets under the current AssetsManagerEx context
---@return self
function AssetsManagerEx:downloadFailedAssets() end
---* @brief Create function for creating a new AssetsManagerEx<br>
---* param manifestUrl The url for the local manifest file<br>
---* param storagePath The storage path for downloaded assets<br>
---* warning The cached manifest in your storage path have higher priority and will be searched first,<br>
---* only if it doesn't exist, AssetsManagerEx will use the given manifestUrl.
---@param manifestUrl string
---@param storagePath string
---@return self
function AssetsManagerEx:create(manifestUrl, storagePath) end
---*
---@param manifestUrl string
---@param storagePath string
---@return self
function AssetsManagerEx:AssetsManagerEx(manifestUrl, storagePath) end

View file

@ -0,0 +1,28 @@
---@meta
---@class cc.AsyncTaskPool
local AsyncTaskPool = {}
cc.AsyncTaskPool = AsyncTaskPool
---@overload fun(int:int,function:function):self
---@overload fun(int:int,function:function,void:void,function:function):self
---@param type int
---@param callback function
---@param callbackParam void
---@param task function
---@return self
function AsyncTaskPool:enqueue(type, callback, callbackParam, task) end
---* Stop tasks.<br>
---* param type Task type you want to stop.
---@param type int
---@return self
function AsyncTaskPool:stopTasks(type) end
---* Destroys the async task pool.
---@return self
function AsyncTaskPool:destroyInstance() end
---* Returns the shared instance of the async task pool.
---@return self
function AsyncTaskPool:getInstance() end
---*
---@return self
function AsyncTaskPool:AsyncTaskPool() end

View file

@ -0,0 +1,95 @@
---@meta
---@class cc.AtlasNode :cc.Node@all parent class: Node,TextureProtocol
local AtlasNode = {}
cc.AtlasNode = AtlasNode
---* lua NA
---@return cc.BlendFunc
function AtlasNode:getBlendFunc() end
---* Initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render
---@param tile string
---@param tileWidth int
---@param tileHeight int
---@param itemsToRender int
---@return boolean
function AtlasNode:initWithTileFile(tile, tileWidth, tileHeight, itemsToRender) end
---* code<br>
---* When this function bound into js or lua,the parameter will be changed<br>
---* In js: var setBlendFunc(var src, var dst)<br>
---* endcode<br>
---* lua NA
---@param blendFunc cc.BlendFunc
---@return self
function AtlasNode:setBlendFunc(blendFunc) end
---* Set an buffer manager of the texture vertex.
---@param textureAtlas cc.TextureAtlas
---@return self
function AtlasNode:setTextureAtlas(textureAtlas) end
---*
---@return cc.Texture2D
function AtlasNode:getTexture() end
---* Return the buffer manager of the texture vertex. <br>
---* return Return A TextureAtlas.
---@return cc.TextureAtlas
function AtlasNode:getTextureAtlas() end
---* updates the Atlas (indexed vertex array).<br>
---* Shall be overridden in subclasses.
---@return self
function AtlasNode:updateAtlasValues() end
---*
---@param texture cc.Texture2D
---@return self
function AtlasNode:setTexture(texture) end
---* Initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render
---@param texture cc.Texture2D
---@param tileWidth int
---@param tileHeight int
---@param itemsToRender int
---@return boolean
function AtlasNode:initWithTexture(texture, tileWidth, tileHeight, itemsToRender) end
---*
---@return unsigned_int
function AtlasNode:getQuadsToDraw() end
---*
---@param quadsToDraw int
---@return self
function AtlasNode:setQuadsToDraw(quadsToDraw) end
---* creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render.<br>
---* param filename The path of Atlas file.<br>
---* param tileWidth The width of the item.<br>
---* param tileHeight The height of the item.<br>
---* param itemsToRender The quantity of items to render.
---@param filename string
---@param tileWidth int
---@param tileHeight int
---@param itemsToRender int
---@return self
function AtlasNode:create(filename, tileWidth, tileHeight, itemsToRender) end
---*
---@param renderer cc.Renderer
---@param transform mat4_table
---@param flags unsigned_int
---@return self
function AtlasNode:draw(renderer, transform, flags) end
---*
---@return boolean
function AtlasNode:isOpacityModifyRGB() end
---*
---@param color color3b_table
---@return self
function AtlasNode:setColor(color) end
---*
---@return color3b_table
function AtlasNode:getColor() end
---*
---@param isOpacityModifyRGB boolean
---@return self
function AtlasNode:setOpacityModifyRGB(isOpacityModifyRGB) end
---*
---@param opacity unsigned_char
---@return self
function AtlasNode:setOpacity(opacity) end
---*
---@return self
function AtlasNode:AtlasNode() end

View file

@ -0,0 +1,29 @@
---@meta
---@class cc.AttachNode :cc.Node
local AttachNode = {}
cc.AttachNode = AttachNode
---* creates an AttachNode<br>
---* param attachBone The bone to which the AttachNode is going to attach, the attacheBone must be a bone of the AttachNode's parent
---@param attachBone cc.Bone3D
---@return self
function AttachNode:create(attachBone) end
---*
---@param renderer cc.Renderer
---@param parentTransform mat4_table
---@param parentFlags unsigned_int
---@return self
function AttachNode:visit(renderer, parentTransform, parentFlags) end
---*
---@return mat4_table
function AttachNode:getWorldToNodeTransform() end
---*
---@return mat4_table
function AttachNode:getNodeToWorldTransform() end
---*
---@return mat4_table
function AttachNode:getNodeToParentTransform() end
---*
---@return self
function AttachNode:AttachNode() end

View file

@ -0,0 +1,148 @@
---@meta
---@class cc.AudioEngine
local AudioEngine = {}
cc.AudioEngine = AudioEngine
---*
---@return boolean
function AudioEngine:lazyInit() end
---* Sets the current playback position of an audio instance.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* param sec The offset in seconds from the start to seek to.<br>
---* return
---@param audioID int
---@param sec float
---@return boolean
function AudioEngine:setCurrentTime(audioID, sec) end
---* Gets the volume value of an audio instance.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* return Volume value (range from 0.0 to 1.0).
---@param audioID int
---@return float
function AudioEngine:getVolume(audioID) end
---* Uncache the audio data from internal buffer.<br>
---* AudioEngine cache audio data on ios,mac, and win32 platform.<br>
---* warning This can lead to stop related audio first.<br>
---* param filePath Audio file path.
---@param filePath string
---@return self
function AudioEngine:uncache(filePath) end
---* Resume all suspended audio instances.
---@return self
function AudioEngine:resumeAll() end
---* Stop all audio instances.
---@return self
function AudioEngine:stopAll() end
---* Pause an audio instance.<br>
---* param audioID An audioID returned by the play2d function.
---@param audioID int
---@return self
function AudioEngine:pause(audioID) end
---* Gets the maximum number of simultaneous audio instance of AudioEngine.
---@return int
function AudioEngine:getMaxAudioInstance() end
---* Check whether AudioEngine is enabled.
---@return boolean
function AudioEngine:isEnabled() end
---* Gets the current playback position of an audio instance.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* return The current playback position of an audio instance.
---@param audioID int
---@return float
function AudioEngine:getCurrentTime(audioID) end
---* Sets the maximum number of simultaneous audio instance for AudioEngine.<br>
---* param maxInstances The maximum number of simultaneous audio instance.
---@param maxInstances int
---@return boolean
function AudioEngine:setMaxAudioInstance(maxInstances) end
---* Checks whether an audio instance is loop.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* return Whether or not an audio instance is loop.
---@param audioID int
---@return boolean
function AudioEngine:isLoop(audioID) end
---* Pause all playing audio instances.
---@return self
function AudioEngine:pauseAll() end
---* Uncache all audio data from internal buffer.<br>
---* warning All audio will be stopped first.
---@return self
function AudioEngine:uncacheAll() end
---* Sets volume for an audio instance.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* param volume Volume value (range from 0.0 to 1.0).
---@param audioID int
---@param volume float
---@return self
function AudioEngine:setVolume(audioID, volume) end
---@overload fun(string:string,function:function):self
---@overload fun(string:string):self
---@param filePath string
---@param callback function
---@return self
function AudioEngine:preload(filePath, callback) end
---* Whether to enable playing audios<br>
---* note If it's disabled, current playing audios will be stopped and the later 'preload', 'play2d' methods will take no effects.
---@param isEnabled boolean
---@return self
function AudioEngine:setEnabled(isEnabled) end
---* Play 2d sound.<br>
---* param filePath The path of an audio file.<br>
---* param loop Whether audio instance loop or not.<br>
---* param volume Volume value (range from 0.0 to 1.0).<br>
---* param profile A profile for audio instance. When profile is not specified, default profile will be used.<br>
---* return An audio ID. It allows you to dynamically change the behavior of an audio instance on the fly.<br>
---* see `AudioProfile`
---@param filePath string
---@param loop boolean
---@param volume float
---@param profile cc.AudioProfile
---@return int
function AudioEngine:play2d(filePath, loop, volume, profile) end
---* Returns the state of an audio instance.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* return The status of an audio instance.
---@param audioID int
---@return int
function AudioEngine:getState(audioID) end
---* Resume an audio instance.<br>
---* param audioID An audioID returned by the play2d function.
---@param audioID int
---@return self
function AudioEngine:resume(audioID) end
---* Stop an audio instance.<br>
---* param audioID An audioID returned by the play2d function.
---@param audioID int
---@return self
function AudioEngine:stop(audioID) end
---* Release objects relating to AudioEngine.<br>
---* warning It must be called before the application exit.<br>
---* lua endToLua
---@return self
function AudioEngine:endToLua() end
---* Gets the duration of an audio instance.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* return The duration of an audio instance.
---@param audioID int
---@return float
function AudioEngine:getDuration(audioID) end
---* Sets whether an audio instance loop or not.<br>
---* param audioID An audioID returned by the play2d function.<br>
---* param loop Whether audio instance loop or not.
---@param audioID int
---@param loop boolean
---@return self
function AudioEngine:setLoop(audioID, loop) end
---* Gets the default profile of audio instances.<br>
---* return The default profile of audio instances.
---@return cc.AudioProfile
function AudioEngine:getDefaultProfile() end
---@overload fun(int0:string):self
---@overload fun(int:int):self
---@param audioID int
---@return cc.AudioProfile
function AudioEngine:getProfile(audioID) end
---* Gets playing audio count.
---@return int
function AudioEngine:getPlayingAudioCount() end

View file

@ -0,0 +1,10 @@
---@meta
---@class cc.AudioProfile
local AudioProfile = {}
cc.AudioProfile = AudioProfile
---* Default constructor<br>
---* lua new
---@return self
function AudioProfile:AudioProfile() end

View file

@ -0,0 +1,13 @@
---@meta
---@class cc.AutoPolygon
local AutoPolygon = {}
cc.AutoPolygon = AutoPolygon
---* create an AutoPolygon and initialize it with an image file<br>
---* the image must be a 32bit PNG for current version 3.7<br>
---* param filename a path to image file, e.g., "scene1/monster.png".<br>
---* return an AutoPolygon object;
---@param filename string
---@return self
function AutoPolygon:AutoPolygon(filename) end

View file

@ -0,0 +1,31 @@
---@meta
---@class cc.BaseLight :cc.Node
local BaseLight = {}
cc.BaseLight = BaseLight
---* light enabled getter and setter.
---@param enabled boolean
---@return self
function BaseLight:setEnabled(enabled) end
---* intensity getter and setter
---@return float
function BaseLight:getIntensity() end
---*
---@return boolean
function BaseLight:isEnabled() end
---* Get the light type,light type MUST be one of LightType::DIRECTIONAL ,<br>
---* LightType::POINT, LightType::SPOT, LightType::AMBIENT.
---@return int
function BaseLight:getLightType() end
---*
---@param flag int
---@return self
function BaseLight:setLightFlag(flag) end
---*
---@param intensity float
---@return self
function BaseLight:setIntensity(intensity) end
---* light flag getter and setter
---@return int
function BaseLight:getLightFlag() end

View file

@ -0,0 +1,29 @@
---@meta
---@class cc.BezierBy :cc.ActionInterval
local BezierBy = {}
cc.BezierBy = BezierBy
---* initializes the action with a duration and a bezier configuration<br>
---* param t in seconds
---@param t float
---@param c cc._ccBezierConfig
---@return boolean
function BezierBy:initWithDuration(t, c) end
---*
---@param target cc.Node
---@return self
function BezierBy:startWithTarget(target) end
---*
---@return self
function BezierBy:clone() end
---*
---@return self
function BezierBy:reverse() end
---* param time In seconds.
---@param time float
---@return self
function BezierBy:update(time) end
---*
---@return self
function BezierBy:BezierBy() end

Some files were not shown because too many files have changed in this diff Show more