> Functions
Copies the value value given as a parameter over level levels and returns the copy. In the case of an array for example, a clone(array, 1) will copy the array but not its elements, a clone(array, 2) will copy the array as well as all its elements.
In JavaScript there is no native equivalent: structuredClone is not available in the Leek Wars engine. For pure data — numbers, strings, arrays, plain objects — JSON.parse(JSON.stringify(value)) does the job, but it loses Maps, Sets, functions and undefined; otherwise, write a recursive copy. Above all, { ...object } and [...array] only copy the first level, unlike clone.
In Python, copy.deepcopy(value), from the copy module, copies deeply like clone, but without any notion of level: the copy is always complete. copy.copy(value) makes a shallow copy, where the sub-lists stay shared with the original. The game API objects (Cell, Leek…) are duplicated too, but they are plain read-only wrappers: the copy stays equal to the original (==) and designates the same element of the fight.
Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.