britzl
August 16, 2024, 6:01am
4
Thanks. We have a task in our backlog to generate these annotations or extern files as part of the rest of the API reference process or as a stand alone thing:
opened 07:59AM - 10 May 24 UTC
task
editor
bob
lua
pipeline
teal
**Task (REQUIRED):**
Initial support for transpilers does not include externs g… eneration for built-in Defold Lua APIs. This limits their usefulness to standalone Lua modules for e.g. game logic. To support interop with Defold APIs, the transpilers need to know about APIs defined in the project, sourced from the engine (i.e. sdoc files) and script_api files from extensions. We should design and implement this support.
**Expected outcome (REQUIRED):**
Transpiler extensions know about Defold APIs.
The API documentation is generated from annotations directly in the engine source code, like this:
/*# set horizontal flipping on a sprite's animations
* Sets horizontal flipping of the provided sprite's animations.
* The sprite is identified by its URL.
* If the currently playing animation is flipped by default, flipping it again will make it appear like the original texture.
*
* @name sprite.set_hflip
* @param url [type:string|hash|url] the sprite that should flip its animations
* @param flip [type:boolean] `true` if the sprite should flip its animations, `false` if not
* @examples
*
* How to flip a sprite so it faces the horizontal movement:
*
* ```lua
* function update(self, dt)
* -- calculate self.velocity somehow
* sprite.set_hflip("#sprite", self.velocity.x < 0)
* end
* ```
*
* It is assumed that the sprite component has id "sprite" and that the original animations faces right.
This file has been truncated. show original
When the source code is built we also have a job which extracts the API annotations into files which are later converted to json and sdoc.
What kind of changes did you have in mind?
1 Like