├── .gitattributes ├── .gitignore ├── LICENSE.txt ├── README.md ├── editor-script-lua-format ├── README.md ├── bin │ ├── darwin │ │ └── lua-format │ ├── linux │ │ └── lua-format │ └── win32 │ │ └── lua-format.exe ├── format_document.editor_script └── git-hooks │ └── pre-commit ├── example.png ├── game.project ├── input └── game.input_binding └── main ├── main.collection ├── test.editor_script ├── test.lua ├── test.render_script └── test.script /.gitattributes: -------------------------------------------------------------------------------- 1 | # Defold Protocol Buffer Text Files (https://github.com/github/linguist/issues/5091) 2 | *.animationset linguist-language=JSON5 gitlab-language=protobuf 3 | *.atlas linguist-language=JSON5 gitlab-language=protobuf 4 | *.camera linguist-language=JSON5 gitlab-language=protobuf 5 | *.collection linguist-language=JSON5 gitlab-language=protobuf 6 | *.collectionfactory linguist-language=JSON5 gitlab-language=protobuf 7 | *.collectionproxy linguist-language=JSON5 gitlab-language=protobuf 8 | *.collisionobject linguist-language=JSON5 gitlab-language=protobuf 9 | *.cubemap linguist-language=JSON5 gitlab-language=protobuf 10 | *.display_profiles linguist-language=JSON5 gitlab-language=protobuf 11 | *.factory linguist-language=JSON5 gitlab-language=protobuf 12 | *.font linguist-language=JSON5 gitlab-language=protobuf 13 | *.gamepads linguist-language=JSON5 gitlab-language=protobuf 14 | *.go linguist-language=JSON5 gitlab-language=protobuf 15 | *.gui linguist-language=JSON5 gitlab-language=protobuf 16 | *.input_binding linguist-language=JSON5 gitlab-language=protobuf 17 | *.label linguist-language=JSON5 gitlab-language=protobuf 18 | *.material linguist-language=JSON5 gitlab-language=protobuf 19 | *.mesh linguist-language=JSON5 gitlab-language=protobuf 20 | *.model linguist-language=JSON5 gitlab-language=protobuf 21 | *.particlefx linguist-language=JSON5 gitlab-language=protobuf 22 | *.render linguist-language=JSON5 gitlab-language=protobuf 23 | *.sound linguist-language=JSON5 gitlab-language=protobuf 24 | *.sprite linguist-language=JSON5 gitlab-language=protobuf 25 | *.spinemodel linguist-language=JSON5 gitlab-language=protobuf 26 | *.spinescene linguist-language=JSON5 gitlab-language=protobuf 27 | *.texture_profiles linguist-language=JSON5 gitlab-language=protobuf 28 | *.tilemap linguist-language=JSON5 gitlab-language=protobuf 29 | *.tilesource linguist-language=JSON5 gitlab-language=protobuf 30 | 31 | # Defold JSON Files 32 | *.buffer linguist-language=JSON gitlab-language=json 33 | 34 | # Defold GLSL Shaders 35 | *.fp linguist-language=GLSL gitlab-language=glsl 36 | *.vp linguist-language=GLSL gitlab-language=glsl 37 | 38 | # Defold Lua Files 39 | *.editor_script linguist-language=Lua gitlab-language=lua 40 | *.render_script linguist-language=Lua gitlab-language=lua 41 | *.script linguist-language=Lua gitlab-language=lua 42 | *.gui_script linguist-language=Lua gitlab-language=lua 43 | 44 | # Defold Project Settings 45 | *.project linguist-language=INI gitlab-language=ini 46 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.internal 2 | /build 3 | .externalToolBuilders 4 | .DS_Store 5 | Thumbs.db 6 | .lock-wscript 7 | *.pyc 8 | .project 9 | .cproject 10 | builtins -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Lua Code Formatter for Defold IDE 2 | 3 | ⚠ The project is archived, no longer maintained. Use [https://github.com/JohnnyMorganz/StyLua](https://github.com/JohnnyMorganz/StyLua) or similar tools. ⚠ 4 | 5 | [![Build Status](https://travis-ci.com/indiesoftby/defold-editor-script-lua-format.svg?branch=build-lua-format)](https://travis-ci.com/indiesoftby/defold-editor-script-lua-format) [![Build status](https://ci.appveyor.com/api/projects/status/bbo48o35tfhfj5t9/branch/build-lua-format?svg=true)](https://ci.appveyor.com/project/aglitchman/defold-editor-script-lua-format/branch/build-lua-format) 6 | 7 | [Defold IDE](https://www.defold.com) editor script that reformats your Lua source code. Uses [LuaFormatter](https://github.com/Koihik/LuaFormatter). 8 | 9 | ## Installation 10 | 11 | ~~You can use this editor script in your own project by adding it as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open your `game.project` file and in the dependencies field under project add:~~ 12 | 13 | ~~[https://github.com/indiesoftby/defold-editor-script-lua-format/archive/master.zip](https://github.com/indiesoftby/defold-editor-script-lua-format/archive/master.zip)~~ 14 | 15 | **The script will work if you simply copy paste the script folder into your project.** 16 | 17 | This script is accessible through the context menu in the asset view, it's context sensitive and will only show when you are clicking on the relevant file - `.lua`, `.script`, `.editor_script`, `.gui_script` or `.render_script`. 18 | 19 | ![](example.png) 20 | 21 | ## Git pre-commit hook 22 | 23 | Git has a way of firing off custom scripts that perform certain operations. These scripts are referred to as *hooks*. The hooks are all stored in the `hooks` subdirectory of the Git directory that's `.git/hooks`. 24 | 25 | *Note:* `.git/hooks` directory isn't cloned with the rest of your project, nor is it under version control. 26 | 27 | `editor-script-lua-format/git-hooks/pre-commit` contains a sample hook that applies a coding style with `lua-format` to staged files. It will help you format your code before you commit them. So when you try to commit your code, given script will run and format staged files. 28 | 29 | Copy contents of the sample pre-commit hook to the custom pre-commit: 30 | 31 | ```bash 32 | $ cp ./editor-script-lua-format/git-hooks/pre-commit ./git/hooks/pre-commit 33 | ``` 34 | 35 | Make the pre-commit script executable (only on Linux and macOS): 36 | 37 | ```bash 38 | $ chmod +x ./git/hooks/pre-commit 39 | ``` 40 | 41 | ## Style configuration 42 | 43 | Lua formatter will attempt to automatically use the root directory's `.lua-format` file. In case there's no file, it will fallback to the default configuration. 44 | 45 | See [this file](https://github.com/Koihik/LuaFormatter/blob/master/docs/Style-Config.md) 46 | 47 | ## Default configuration 48 | 49 | ``` 50 | column_limit: 80 51 | indent_width: 4 52 | use_tab: false 53 | tab_width: 4 54 | continuation_indent_width: 4 55 | spaces_before_call: 1 56 | keep_simple_control_block_one_line: true 57 | keep_simple_function_one_line: true 58 | align_args: true 59 | break_after_functioncall_lp: false 60 | break_before_functioncall_rp: false 61 | align_parameter: true 62 | chop_down_parameter: false 63 | break_after_functiondef_lp: false 64 | break_before_functiondef_rp: false 65 | align_table_field: true 66 | break_after_table_lb: true 67 | break_before_table_rb: true 68 | chop_down_table: false 69 | chop_down_kv_table: true 70 | table_sep: "," 71 | extra_sep_at_table_end: false 72 | break_after_operator: true 73 | double_quote_to_single_quote: false 74 | single_quote_to_double_quote: false 75 | ``` 76 | 77 | ## Limitations 78 | 79 | - Does not work when source file contains syntax error 80 | 81 | ## License 82 | 83 | Apache 2 License. 84 | -------------------------------------------------------------------------------- /editor-script-lua-format/README.md: -------------------------------------------------------------------------------- 1 | ## Git pre-commit hook 2 | 3 | Git has a way of firing off custom scripts that perform certain operations. These scripts are referred to as *hooks*. The hooks are all stored in the `hooks` subdirectory of the Git directory that's `.git/hooks`. 4 | 5 | *Note:* `.git/hooks` directory isn't cloned with the rest of your project, nor is it under version control. 6 | 7 | `editor-script-lua-format/git-hooks/pre-commit` contains a sample hook that applies a coding style with `lua-format` to staged files. It will help you format your code before you commit them. So when you try to commit your code, given script will run and format staged files. 8 | 9 | Copy contents of the sample pre-commit hook to the custom pre-commit: 10 | 11 | ```bash 12 | $ cp ./editor-script-lua-format/git-hooks/pre-commit ./git/hooks/pre-commit 13 | ``` 14 | 15 | Make the pre-commit script executable (only on Linux and macOS): 16 | 17 | ```bash 18 | $ chmod +x ./git/hooks/pre-commit 19 | ``` 20 | 21 | ## Style configuration 22 | 23 | Lua formatter will attempt to automatically use the root directory's `.lua-format` file. In case there's no file, it will fallback to the default configuration. 24 | 25 | See [this file](https://github.com/Koihik/LuaFormatter/blob/master/docs/Style-Config.md) 26 | 27 | ## Default configuration 28 | 29 | ``` 30 | column_limit: 80 31 | indent_width: 4 32 | use_tab: false 33 | tab_width: 4 34 | continuation_indent_width: 4 35 | spaces_before_call: 1 36 | keep_simple_control_block_one_line: true 37 | keep_simple_function_one_line: true 38 | align_args: true 39 | break_after_functioncall_lp: false 40 | break_before_functioncall_rp: false 41 | align_parameter: true 42 | chop_down_parameter: false 43 | break_after_functiondef_lp: false 44 | break_before_functiondef_rp: false 45 | align_table_field: true 46 | break_after_table_lb: true 47 | break_before_table_rb: true 48 | chop_down_table: false 49 | chop_down_kv_table: true 50 | table_sep: "," 51 | extra_sep_at_table_end: false 52 | break_after_operator: true 53 | double_quote_to_single_quote: false 54 | single_quote_to_double_quote: false 55 | ``` 56 | 57 | ## Limitations 58 | 59 | - Does not work when source file contains syntax error 60 | -------------------------------------------------------------------------------- /editor-script-lua-format/bin/darwin/lua-format: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indiesoftby/defold-editor-script-lua-format/7ed327573ee36f35a9c8732eebc4c289ecdf09d1/editor-script-lua-format/bin/darwin/lua-format -------------------------------------------------------------------------------- /editor-script-lua-format/bin/linux/lua-format: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indiesoftby/defold-editor-script-lua-format/7ed327573ee36f35a9c8732eebc4c289ecdf09d1/editor-script-lua-format/bin/linux/lua-format -------------------------------------------------------------------------------- /editor-script-lua-format/bin/win32/lua-format.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indiesoftby/defold-editor-script-lua-format/7ed327573ee36f35a9c8732eebc4c289ecdf09d1/editor-script-lua-format/bin/win32/lua-format.exe -------------------------------------------------------------------------------- /editor-script-lua-format/format_document.editor_script: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local function ends_with(str, ending) 4 | return ending == "" or str:sub(-#ending) == ending 5 | end 6 | 7 | function M.get_commands() 8 | return { 9 | { 10 | label = "Format Document", 11 | locations = {"Edit", "Assets"}, 12 | query = {selection = {type = "resource", cardinality = "one"}}, 13 | active = function(opts) 14 | local path = editor.get(opts.selection, "path") 15 | return ends_with(path, ".lua") or ends_with(path, ".script") or 16 | ends_with(path, ".editor_script") or 17 | ends_with(path, ".gui_script") or 18 | ends_with(path, ".render_script") 19 | end, 20 | run = function(opts) 21 | local path = editor.get(opts.selection, "path") 22 | path = path:sub(2) 23 | 24 | if editor.platform == "x86_64-win32" then 25 | return { 26 | { 27 | action = "shell", 28 | command = { 29 | "cmd", "/C", 30 | "editor-script-lua-format\\bin\\win32\\lua-format.exe", 31 | "-i", path 32 | } 33 | } 34 | } 35 | elseif editor.platform == "x86_64-darwin" then 36 | return { 37 | { 38 | action = "shell", 39 | command = { 40 | "./editor-script-lua-format/bin/darwin/lua-format", 41 | "-i", path 42 | } 43 | } 44 | } 45 | elseif editor.platform == "x86_64-linux" then 46 | return { 47 | { 48 | action = "shell", 49 | command = { 50 | "./editor-script-lua-format/bin/linux/lua-format", 51 | "-i", path 52 | } 53 | } 54 | } 55 | else 56 | print("ERROR: Not supported platform") 57 | return nil 58 | end 59 | end 60 | } 61 | } 62 | end 63 | 64 | return M 65 | -------------------------------------------------------------------------------- /editor-script-lua-format/git-hooks/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copy contents of this sample pre-commit hook to the custom pre-commit 3 | # $ cp ./editor-script-lua-format/git-hooks/pre-commit .git/hooks/pre-commit 4 | # Make the pre-commit script executable (only on Linux and macOS) 5 | # $ chmod +x .git/hooks/pre-commit 6 | 7 | # Check for lua-format executable 8 | BIN_PATH=./editor-script-lua-format/bin 9 | if [ "$(uname)" = "Darwin" ]; then 10 | LUA_FORMAT=$BIN_PATH/darwin/lua-format 11 | chmod +x $LUA_FORMAT 12 | elif [ "$(expr substr $(uname -s) 1 5)" = "Linux" ]; then 13 | LUA_FORMAT=$BIN_PATH/linux/lua-format 14 | chmod +x $LUA_FORMAT 15 | elif [ "$(expr substr $(uname -s) 1 10)" = "MINGW32_NT" ]; then 16 | LUA_FORMAT=$BIN_PATH/win32/lua-format.exe 17 | elif [ "$(expr substr $(uname -s) 1 10)" = "MINGW64_NT" ]; then 18 | LUA_FORMAT=$BIN_PATH/win32/lua-format.exe 19 | fi 20 | 21 | $LUA_FORMAT -h >/dev/null 2>&1 || { echo >&2 "This hook requires 'lua-format'. Aborting."; exit 1; } 22 | 23 | # Find Lua files 24 | FILES=$(git diff --cached --name-only --diff-filter=ACMR "*.lua" "*.script" "*.editor_script" "*.gui_script" "*.render_script" | sed 's| |\\ |g') 25 | [ -z "$FILES" ] && exit 0 26 | 27 | # Prettify all selected files 28 | echo "$FILES" | xargs $LUA_FORMAT -i 29 | 30 | # Add back the modified/prettified files to staging 31 | echo "$FILES" | xargs git add 32 | 33 | exit 0 34 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/indiesoftby/defold-editor-script-lua-format/7ed327573ee36f35a9c8732eebc4c289ecdf09d1/example.png -------------------------------------------------------------------------------- /game.project: -------------------------------------------------------------------------------- 1 | [bootstrap] 2 | main_collection = /main/main.collectionc 3 | 4 | [script] 5 | shared_state = 1 6 | 7 | [project] 8 | title = editor-script-lua-format 9 | 10 | [library] 11 | include_dirs = editor-script-lua-format 12 | -------------------------------------------------------------------------------- /input/game.input_binding: -------------------------------------------------------------------------------- 1 | mouse_trigger { 2 | input: MOUSE_BUTTON_LEFT 3 | action: "touch" 4 | } 5 | -------------------------------------------------------------------------------- /main/main.collection: -------------------------------------------------------------------------------- 1 | name: "main" 2 | scale_along_z: 0 3 | -------------------------------------------------------------------------------- /main/test.editor_script: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.get_commands() 4 | return {} 5 | end 6 | 7 | return M 8 | -------------------------------------------------------------------------------- /main/test.lua: -------------------------------------------------------------------------------- 1 | q = { 2 | w = { -- empty 3 | }, 4 | 5 | -- keep custom blank line 6 | e = {--[[comment]]}; 7 | r = { 8 | --empty 9 | }, 10 | -- comment 11 | nothing = { 12 | 13 | 14 | 15 | 16 | } 17 | -- comment 18 | } 19 | --last comment -------------------------------------------------------------------------------- /main/test.render_script: -------------------------------------------------------------------------------- 1 | function init(self) 2 | -- Add initialization code here 3 | -- Remove this function if not needed 4 | end 5 | 6 | function final(self) 7 | -- Add finalization code here 8 | -- Remove this function if not needed 9 | end 10 | 11 | function update(self, dt) 12 | -- Add update code here 13 | -- Remove this function if not needed 14 | end 15 | 16 | function on_message(self, message_id, message, sender) 17 | -- Add message-handling code here 18 | -- Remove this function if not needed 19 | end 20 | 21 | function on_reload(self) 22 | -- Add reload-handling code here 23 | -- Remove this function if not needed 24 | end 25 | -------------------------------------------------------------------------------- /main/test.script: -------------------------------------------------------------------------------- 1 | function init(self) 2 | -- Add initialization code here 3 | -- Remove this function if not needed 4 | end 5 | 6 | function final(self) 7 | -- Add finalization code here 8 | -- Remove this function if not needed 9 | end 10 | 11 | function update(self, dt) 12 | -- Add update code here 13 | -- Remove this function if not needed 14 | end 15 | 16 | function on_message(self, message_id, message, sender) 17 | -- Add message-handling code here 18 | -- Remove this function if not needed 19 | end 20 | 21 | function on_input(self, action_id, action) 22 | -- Add input-handling code here 23 | -- Remove this function if not needed 24 | end 25 | 26 | function on_reload(self) 27 | -- Add reload-handling code here 28 | -- Remove this function if not needed 29 | end 30 | --------------------------------------------------------------------------------