You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/doc/index.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ If you don't have Discord or you don't want to use it, please file an issue on G
48
48
49
49
## Supported languages
50
50
51
-
The main language supported is Kotlin. We do however support Java experimentally. It should be possible to support other JVM-based languages as well but this is not the focus of this project. If you want to have support for other languages, have a look at [support for other JVM-based languages](contribution/support-for-other-jvm-based-languages.md).
51
+
The main language supported is Kotlin. We do however support Java and Scala experimentally. It should be possible to support other JVM-based languages as well but this is not the focus of this project. If you want to have support for other languages, have a look at [support for other JVM-based languages](contribution/support-for-other-jvm-based-languages.md).
52
52
53
53
## Supported platforms
54
54
@@ -85,7 +85,7 @@ Contrary to the official binaries, there are two builds of the editor per Platfo
85
85
`release` editors are the editors you use normally. `debug` editors provide debug symbols and are intended to provide better stacktraces in case of crashes of the editor. Please use those when submitting bugreports.
86
86
87
87
!!! warning
88
-
This module will NOT work with the official Godot Editor and Export Templates! To be able to use Kotlinand Java scripts in Godot, you need our Editor and Export Templates builds.
88
+
This module will NOT work with the official Godot Editor and Export Templates! To be able to use Kotlin, Java and Scala scripts in Godot, you need our Editor and Export Templates builds.
Copy file name to clipboardExpand all lines: docs/src/doc/user-guide/api-differences.md
+19-4
Original file line number
Diff line number
Diff line change
@@ -5,9 +5,9 @@ Godot Kotlin/JVM offers two different ways to attach scripts:
5
5
- Source files
6
6
- Registration files.
7
7
8
-
## Source files .ktand .java
8
+
## Source files .kt, .java and .scala
9
9
10
-
Just like you would do with GDScript, you can directly attach your Kotlin/Java files to Nodes as scripts.
10
+
Just like you would do with GDScript, you can directly attach your Kotlin/Java/Scala files to Nodes as scripts.
11
11
This is the most straightforward method to use Kotlin scripts but not the most flexible.
12
12
13
13
The limitations are the following:
@@ -20,7 +20,7 @@ The limitations are the following:
20
20
var test_script:MyScript= load("res://pathToScript/MyScript.kt").new() // Wrong
21
21
var test_script:Node= load("res://pathToScript/MyScript.kt").new() // Correct
22
22
```
23
-
The same applies if you use a Godotobject with a .kt/.java attached to it
23
+
The same applies if you use a Godotobject with a .kt/.java/.scala attached to it
24
24
25
25
If those limitations don't apply to you, feel free to use Kotlin source files directly.
26
26
@@ -32,7 +32,7 @@ They have several benefits over source files:
32
32
- .gdj can be placed wherever you want in your Godot project, you are not limited to the source set.
33
33
- Each script get its own .gdj. This includes scripts in different modules and libraries.
34
34
- If a source file contains several scripts. A different .gdj will be generated for each.
35
-
- Registration files are language agnostic, they are generated for Kotlinand Java files with no difference.
35
+
- Registration files are language agnostic, they are generated for Kotlin, Java and Scala files with no difference.
36
36
- When creating a script from code using its registered name. The module is going to use the registration file as the script. Therefore, registration files are treated as the default way to use scripts inside the module.
37
37
38
38
By default, these files are generated into a folder called `gdj` in the root of your project.
@@ -182,6 +182,14 @@ This kind of operation can be costly so we provide extension functions which cac
182
182
```
183
183
///
184
184
185
+
/// tab | Scala
186
+
```scala
187
+
val stringName = StringNames.asCachedStringName("myString")
188
+
val nodePath = NodePaths.asCachedNodePath("myNode/myChildNode")
189
+
val snakeCaseStringName = StringNames.toGodotName("myString")
190
+
```
191
+
///
192
+
185
193
You can also use the non-cached version of them if you simply want ease of conversion:
186
194
187
195
/// tab | Kotlin
@@ -198,6 +206,13 @@ You can also use the non-cached version of them if you simply want ease of conve
198
206
```
199
207
///
200
208
209
+
/// tab | Scala
210
+
```scala
211
+
val stringName = StringNames.asStringName("myString")
212
+
val nodePath = NodePaths.asNodePath("myNode/myChildNode")
0 commit comments