generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Why does this print nil before everything else?

Previous Thread :: Next Thread 
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
27 Aug 2016 10:10 PM
myt={0,8,10,1,3,5,7,9}



print( table.sort(myt), table.concat(myt, " "))
Report Abuse
ImaginaryNumber is not online. ImaginaryNumber
Joined: 07 Sep 2013
Total Posts: 48
27 Aug 2016 10:12 PM
myt={0,8,10,1,3,5,7,9}

table.sort(myt)
print( table.concat(myt, " "))



Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
27 Aug 2016 10:12 PM
table.sort returns nil, my dude!
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
27 Aug 2016 10:14 PM
^^ Thanks.

I feel sad that in my two-three years of scripting, I haven't really touched tables enough to understand them. This really helps me in understanding it, so that I can be able to make more complex games.

Thanks guys! :)
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
27 Aug 2016 10:26 PM
you can also use unpack instead of table.concat
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Aug 2016 10:51 PM
table.sort will sort the table and return nil

so it will store the new stuff into the old table
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
27 Aug 2016 10:56 PM
It doesn't "return nil", it returns nothing. There's a difference.
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
27 Aug 2016 10:56 PM
Oh really? That's super cool!!! I'd be really happy that you shared that information, except that this thread has already been solved and everything you say is useless :/

oops
Report Abuse
enzo90 is not online. enzo90
Joined: 25 Mar 2012
Total Posts: 7104
27 Aug 2016 11:38 PM
^ lol
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Aug 2016 11:40 PM
there is a difference but it is treated the same way in lua
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Aug 2016 11:41 PM
so technically it does not return nil but the value returned from it is nonexistent so is replaced by nil
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
27 Aug 2016 11:45 PM
"there is a difference but it is treated the same way in lua"
no it's not
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Aug 2016 11:45 PM
yes it is

function hi()

end

function hi2()
return nil
end

print(hi())
print(hi2())
Report Abuse
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
27 Aug 2016 11:46 PM
You're using an awful example, if you understood Lua you would know why what you posted it not proof.

print(type(print()))
print(type(nil))

I would give a technical explanation but I don't feel like you would care (since you're stubborn and arrogant, after all)
Report Abuse
thedailyblarg is not online. thedailyblarg
Joined: 26 Feb 2012
Total Posts: 5506
27 Aug 2016 11:46 PM
####################################
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image