sandstone-mc / sandstone

Sandstone | Next Generation Framework for Minecraft
https://sandstone.dev/
MIT License
173 stars 16 forks source link

Make rel() and loc() return default values if no argument is passed #108

Closed Aeryle closed 2 years ago

Aeryle commented 3 years ago

Current behavior of relative and local function:

relative()        // Expected at least 1 arguments, but got 0.
relative(0)       // '~'
relative(0, 0, 0) // ['~', '~', '~']

local()           // Expected at least 1 arguments, but got 0.
local(0)          // '^'
local(0, 0, 0)    // ['^', '^', '^']

New behavior:

relative()         // ['~', '~', '~']
relative(0)        // '~'
relative(0, 0, 0)  // ['~', '~', '~']

local()            // ['^', '^', '^']
local(0)           // '^'
local(0, 0, 0)     // ['^', '^', '^']

With this PR, relative() and local() is the same as doing relative(0, 0, 0) and local(0, 0, 0).

Tell me if you see anything to improve.

You can test this PR using npm i aeryle/sandstone