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 » Scripting Helpers
Home Search
 

Re: type()

Previous Thread :: Next Thread 
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Dec 2011 12:12 AM
I know what type is, but why would you use it?
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
27 Dec 2011 12:16 AM
There are a lot of uses. Since Lua is not statically typed, any variable can ave any type. To help prevent undefined behavior, a person can use type to error a function if the type is not correct.

It's essentially used when someone creates an API for others to use. Instead of forcing the users to look in the source code for the error, getting the type and then erroring if it's wrong makes it much easier to catch errors.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
27 Dec 2011 12:16 AM
print(type("hi")) --> string
print(type(4)) --> number
print(type({})) --> table
print(type(coroutine.create(function() end))) --> thread
print(type(function() end)) --> function
print(type(newproxy())) --> userdata

Those are all strings, all lowercase letters. Rather simple to use.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Dec 2011 12:19 AM
@legend26

Oh ok, that helps!

And since you guys are here, what is the point of _VERSION?
Report Abuse
Legend26 is not online. Legend26
Joined: 08 Sep 2008
Total Posts: 10586
27 Dec 2011 12:22 AM
I'm guessing it's just a fast way for a programmer to know what version of Lua he's using. There's really no use unless you need to know what the version that is being used is.

Or perhaps the program has different versions in use that have different versions of Lua. If you make something that you want to work for both versions you might use it, although I really don't see that happening.
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
27 Dec 2011 12:28 AM
Umm....Ok...Thanks?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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