Skip to content
[~]drawing-functions.md: updated line_func() authored by gibbonjoyeux's avatar gibbonjoyeux
...@@ -106,11 +106,17 @@ Calls the passed function for each point of the line formed by `[x0, y0]` and ...@@ -106,11 +106,17 @@ Calls the passed function for each point of the line formed by `[x0, y0]` and
of the current point and a boolean variable which is set to `true` when the of the current point and a boolean variable which is set to `true` when the
coordinates are inside the active layer. coordinates are inside the active layer.
If the passed function returns `true` to it's call, `line_func()` will stop.
Here is an example of a function passed to `line_func()`: Here is an example of a function passed to `line_func()`:
```javascript ```javascript
function (x, y, is_on_layer) { function my_line_drawing(x, y, is_on_layer) {
if (is_on_layer == true) { if (is_on_layer == true) {
if (my_layer[y][x] == ' ') {
my_layer[y][x] = '#'; my_layer[y][x] = '#';
} else {
return (true);
}
} }
} }
``` ```
... ...
......