blockly-lua
blockly-lua copied to clipboard
[Suggestion] Varargs
In Lua it is possible to have vararg functions, I'm sure you should know what they are as they're in multiple languages, I think blockly-lua having support would be good.
examples
local args = {...} -- getting all the runtime args of the program
local function foo(...) -- vararg function
local args = {...} -- varargs of the function
print(...) -- print is a vararg function it will concat all these together and output them
end
-- calling vararg functions is not a static amount
foo("bar")
foo("bar", "hello", "world")
Support for calling vararg procedures would be easy. I'd use a "mutator", as shown for text create.
For creating vararg procedures, it would be much easier to just create procedures that take a list (table with keys of 1, 2, ...) as an argument. Doing things right would be hard, although you're welcome to take it on.
Yeh I definitely don't think any of my suggestions are the easiest to implement... I just felt I'd add them all since I have more experience (just over 2 years now if I remember correctly) in ComputerCraft/Lua, as they can be very vital and/or useful parts of the language, and/or language syntax...
I may take a further look into this one once Uni is finished for the semester as well as #5