From 5ffc7122ef6544ff201e70b5aa1376e6c0b032f1 Mon Sep 17 00:00:00 2001 From: COCO Date: Fri, 17 May 2024 16:20:12 +0800 Subject: [PATCH] Document .luacheckrc for zh (#437) * Minor edit to building blocks intro text * update gamepad & ios * project settings * libffi version * scaling * image compression * update gamepads * increase memory * caching assets * update 2021/10/6 * update 2021/10/16 blend-modes.md * update 2021/11/12 * allow dynamic transforms update * Bundle update * update faq * bullet & bob * script properties update * editor-styling * build server url * editor templates * spine extension update * Fix typo in the "optimizations" word in Chinese docs * Update to material.md - Constants buffers * Verify Graphics Calls * H5 parameters * OpenJDK downloads * cn update corresponds to [pull 259](https://github.com/defold/doc/pull/259) * application security * porting guidelines * update for 8f1651f * cn update for 094bf6f * cn update for 20fdfc5 & 6263317 * cn update for 7/19/2022 * title * profiling update * update editor.md * update bob.md * update shortcuts * update fixed update note * Update properties.md * Update material.md * Updates links * Update bob help with the latest info * camera & renderer * Updated android keystore info zh_cn * bundling.md release vs debug zh_cn * update bob.md & gui-clipping.md * contentless bundle * consoles update * model animation link * gamepad & faq * remove a camera lib * font shadow render mode fix * updates about app-manifest and others * Update script.md * includes in shaders * editor scripts * material updates * Added dynamic atlas and texture creation * fixes for atlas and some others * update screenshots and add explanations (CN) * add a line about Dynamic Prototype (CN) * remove "inline" marks in pics * de-translate the subtitle "Running the debugger" & images fix * bundle identifier restrictions * node properties Enabled and Visible (CN) * release checklist & slice-9 * Update project-settings.md (CN) * Update camera.md (CN) * Update project-settings.md (CN) * culling of meshes (CN) * Update project-settings.md (CN) * gltf model file support (CN) * updates about factory (CN) * Update bob.md (CN) * Update bob.jar help (CN) * Update about renderer and other things * Update PS4 development and other things * Dynamic prototype part of the collection factory. * sync to atlas.md * sync to design.md * sync to gpgs.md * sync to hot-reload.md * sync to linux.md * sync to live-update.md * sync to lua.md * sync to networking.md * sync to physics-shapes.md * sync to push.md * sync to test.md * sync to working-offline.md * update material.md * update zerobrane.md * all done * Splitting .zip archives in live-update.md * manual for collision events * Updated sprite documentation to include info about multiple textures * update editor-scripts.md & physics-events.md * update buffer.md & physics-shapes.md * screen blend mode * Update camera manual for zh with new function. * Fix texture profile documentation for 1.7.0 zh * update material.md & render.md * notice about physics-events * script-properties notes & PS5 * Clarified collision messages * Update 3rd party camera list * Fixed links in live update manual zh * Update lua.md * Update html5 manual with new information about CUSTOM_PARAMETERS. zh * Added note on Apple Privacy Manifests zh * typo * Add info about collection proxies for zh * fix minor mistakes * typo * custom resource & physics.set_shape * Add missing type property in the physics.set_shape for zh * html5 param & coordinates convertion * Update install.md for zh * Added app manifest manual for zh * Added more info on build variants for zh * lua transpilers and ImageMagick usage * merging plists & Remove LSP * Document .luacheckrc for zh * title added --- docs/zh/manuals/writing-code.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/zh/manuals/writing-code.md b/docs/zh/manuals/writing-code.md index 3ffa949f..be8666a2 100644 --- a/docs/zh/manuals/writing-code.md +++ b/docs/zh/manuals/writing-code.md @@ -19,7 +19,7 @@ Defold 使用 Lua 5.1 和 LuaJIT (与目标平台相关) 并且需要遵循 Lua Defold 允许使用原生代码来扩展游戏引擎以使用引擎所不具备的特定功能. 或者 Lua 性能不良时 (密集计算, 图像处理等) 考虑使用原生扩展. 详情请见 [原生扩展教程](/manuals/extensions/). -## Using the built-in code editor +## 使用内置代码编辑器 Defold 中内建编辑器可以打开和编辑 Lua 文件 (.lua), Defold 脚本文件 (.script, .gui_script 与 .render_script) 或者其他各类文件. 但只对Lua和脚本文件提供代码高亮. @@ -36,6 +36,20 @@ Defold 中内建编辑器可以打开和编辑 Lua 文件 (.lua), Defold 脚本 ![](/images/editor/apireference.png) +### 检查配置 + +内置代码编辑器使用 Luacheck 和 Lua language server 进行代码检查. 为了配置检查, 需要在项目根目录创建 .luacheckrc 文件. 可用的配置列表可以参考 Luacheck 配置页面. Defold 默认使用如下代码进行 Luacheck 配置: + +```lua +unused_args = false -- 未使用的参数不提示 (一般用于 .script 文件) +max_line_length = false -- 超长行不提示 +ignore = { + "611", -- 行内只包含空白 + "612", -- 行尾包含空白 + "614" -- 注释结尾包含空白 +}, +``` + ## 使用第三方代码编辑器 尽管 Defold 提供了编写脚本的基本功能, 但是对于需求更多功能的专业开发者来说还是希望让 Defold 使用自己喜欢的第三方编辑器. 在 [Code 页下的 Preferences 窗口 ](/manuals/editor-preferences/#code) 中可以指定使用第三方编辑器.