New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Print function stops printing if there is a nil present in the input array. #78
Comments
|
This is intended, as any function that takes an unlimited number of parameters stops after the first nil. In fact, lua tables don't even keep nil values (converting any values after a nil to key indexed values rather than keeping the array), which makes taking all parameters after the nil next to impossible to do efficiently. Find an alternate way to print the values, such as removing the value from the table entirely, or checking for nil before adding it. |
|
Kubuxu says spec is to print the whole list, you say it's spec not to. Where do you guys get these specs from? FWIW, I'd run a basic "for n = 1, whatever do" loop that manually indexes into the arg table on each iteration. Either use #arg or arg.n in place of "whatever", depending on the desired behaviour. As far as I'm aware, this'd be more efficient than calling an iterator function every time the loop repeats, wouldn't it be? |
|
My assumption is based on how the Lua manual seems to advise using |
|
Standalone lua is the reference implementation. Somebody test it in that?
|
|
According to http://www.lua.org/cgi-bin/demo output |
|
Sounds like a worthwhile change then. Will fix |
|
Fixed for 1.77 |
Originally Kubuxu came up with this bug/feature request linked here:
Kubuxu/ComputercraftLua@17dd0e4
VERSION:
1.41 to 1.76 (probably earlier too)
DESCRIPTION:
i typed print(1,2,nil,3) and it printed 1 2
EXPECTED RESULT:
1 2 nil 3
REPRODUCTION STEPS:
lua -> print(1,2,nil,3)
The text was updated successfully, but these errors were encountered: