Code sample issues on Variadic Functions page

On this page: https://developer.roblox.com/en-us/articles/Variadic-Functions

The first code sample includes the line:

print( string.byte(115, 101, 99, 114, 101, 116) )

…which is said to print “secret”. This is incorrect - it will not print anything.

string.byte should be replaced with string.char.


In the final code sample’s corresponding ‘Output’ section, there is a line of text:

Note that if you write a function taking variadic arguments, and find yourself unpacking tables of values, you should probably instead just pass the table directly to the function.

This should be placed outside of (below) the Output code block.

6 Likes

So, will

print( string.char(115, 101, 99, 114, 101, 116) )

print secret?

(I don’t have studio open.)

1 Like

You don’t need studio open – but yes.

image

(click on image to go to link)

1 Like

Another issue with the same page: at the bottom code sample, there is a line that looks like code that isn’t supposed to be.

The 2nd line of the Output is supposed to be normal text.

1 Like

Oh, okay. I thought maybe

print(string.char(115, 101, 99, 114, 101, 116))

was only for Roblox Studio and not for all Lua.