mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Merge branch 'master' into 3.2
This commit is contained in:
@@ -16,34 +16,10 @@ flexibility for content creation and integration.
|
||||
History
|
||||
~~~~~~~
|
||||
|
||||
In the early days, the engine used the `Lua <https://www.lua.org>`__
|
||||
scripting language. Lua is fast, but creating bindings to an object
|
||||
oriented system (by using fallbacks) was complex and slow and took an
|
||||
enormous amount of code. After some experiments with
|
||||
`Python <https://www.python.org>`__, it also proved difficult to embed.
|
||||
.. note::
|
||||
|
||||
The last third party scripting language that was used for shipped games
|
||||
was `Squirrel <http://squirrel-lang.org>`__, but it was dropped as well.
|
||||
At that point, it became evident that a custom scripting language could
|
||||
more optimally make use of Godot's particular architecture:
|
||||
|
||||
- Godot embeds scripts in nodes. Most languages are not designed with
|
||||
this in mind.
|
||||
- Godot uses several built-in data types for 2D and 3D math. Script
|
||||
languages do not provide this, and binding them is inefficient.
|
||||
- Godot uses threads heavily for lifting and initializing data from the
|
||||
net or disk. Script interpreters for common languages are not
|
||||
friendly to this.
|
||||
- Godot already has a memory management model for resources, most
|
||||
script languages provide their own, which results in duplicate
|
||||
effort and bugs.
|
||||
- Binding code is always messy and results in several failure points,
|
||||
unexpected bugs and generally low maintainability.
|
||||
|
||||
The result of these considerations is *GDScript*. The language and
|
||||
interpreter for GDScript ended up being smaller than the binding code itself
|
||||
for Lua and Squirrel, while having equal functionality. With time, having a
|
||||
built-in language has proven to be a huge advantage.
|
||||
Documentation about GDScript's history has been moved to the
|
||||
:ref:`Frequently Asked Questions <doc_faq_what_is_gdscript>`.
|
||||
|
||||
Example of GDScript
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
@@ -1434,7 +1410,7 @@ Our ``BattleLog`` node receives each element in the binds array as an extra argu
|
||||
func _on_Character_health_changed(old_value, new_value, character_name):
|
||||
if not new_value <= old_value:
|
||||
return
|
||||
|
||||
|
||||
var damage = old_value - new_value
|
||||
label.text += character_name + " took " + str(damage) + " damage."
|
||||
|
||||
|
||||
Reference in New Issue
Block a user