A Roblox Community

A community of Robloxians who want to learn to script and build on Roblox Studio.
 
HomeFAQRegisterLog in
If you're a experienced coder make some tutorials! It would really help the site grow.
Make sure you read the rules(Which can be found by clicking here)
If you're a beginner at coding, try some tutorials.
We have many Moderators/Admins watching this site. Contact them with Questions.
Let us know what your favorite sport is. By clicking here to vote (Click here)
This site is becoming inactive. Lets make it active.
Log in
Username:
Password:
Log in automatically: 
:: I forgot my password
Top posters
blueymaddog
 
naknak
 
Supernapalm
 
m27frogy
 
slayer9365
 
myrco919
 
branefreez
 
ninga95
 
CloneTrooper787
 
raboy117
 
Top posting users this month
Latest topics
» Send me an Email
January 8th 2016, 10:14 am by naknak

» [v1.6.0.0] Lua Script Obfuscator [No Bytecode]
July 6th 2015, 7:38 pm by m27frogy

» New Site Possibly
July 6th 2015, 4:16 pm by m27frogy

» Ambassador!
April 15th 2015, 11:40 pm by naknak

» Boop - Tag
April 13th 2015, 9:46 pm by naknak

» Vip Class Script
April 13th 2015, 4:54 pm by naknak

» Who's active?!
April 13th 2015, 4:52 pm by naknak

» Where to go from here.
April 13th 2015, 4:51 pm by naknak

» Genesis Point
July 17th 2014, 7:04 pm by branefreez

» Reward System
July 17th 2014, 5:41 am by m27frogy

» Script Request
July 10th 2014, 11:43 am by naknak

» local scripts?
July 10th 2014, 11:39 am by naknak

» Project: Reconstruction [Died]
July 10th 2014, 11:36 am by naknak

» Hi. I am new here
April 26th 2014, 4:01 pm by altshiftkey

» What's your favorite sport?
January 1st 2014, 2:13 pm by m27frogy

» FlashLight Script
January 1st 2014, 2:11 pm by m27frogy

» Gun Making! [READ DESC]
January 1st 2014, 2:10 pm by m27frogy

» Hi, I am new here!
November 26th 2013, 3:33 pm by Keanu73

» Improve Coding
October 26th 2013, 1:12 pm by pook03

» Simple Button
September 1st 2013, 6:19 pm by branefreez


Share | 
 

 Refering to functions as objects?

View previous topic View next topic Go down 
AuthorMessage
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Refering to functions as objects?   March 18th 2012, 7:36 pm

I've noticed in Telamon's leaderstats script, that he refers to "killer" as an object, but its value is a function? How is that possible? How can I use this to create and insert a table of guis?
Back to top Go down
naknak
Administrator
Administrator
avatar

Posts : 878
Join date : 2010-07-30

PostSubject: Re: Refering to functions as objects?   March 18th 2012, 9:47 pm

How is it referenced?
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Refering to functions as objects?   March 19th 2012, 4:43 am

i thought 'killer' was an object value...

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Re: Refering to functions as objects?   March 19th 2012, 8:44 am

local killer = getKillerOfHumanoidIfStillInGame(humanoid)

if killer ~= nil then
...
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Refering to functions as objects?   March 20th 2012, 3:32 am

that means it it was referring the the values returned from that function not the function itself:

function aFunction()
return 10
end

aCall = aFunction()
aFunctionReference = aFunction
print(aCall)
print(aFunctionRefence)

>10
>function: [hexadecimalcodehere]

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Re: Refering to functions as objects?   March 20th 2012, 8:38 am

Cool, but can you refer to more than one object, or maybe a table?
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Refering to functions as objects?   March 21st 2012, 3:30 am

function ReturnTable()
return {1,4,3,5}
end

function Return3Values()
return 1,3,5
end

tab = ReturnTable()
x,y,z = Return3Values()

print(x,z)
>1 5
print(tab[2],tab[4])
>4 5

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Refering to functions as objects?   March 21st 2012, 3:35 am

you can even reference objects like in the leaderboard script:

function ReturnWorkspace()
return worksapce
end

work = ReturnWorkspace()

print(work.Name)

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Re: Refering to functions as objects?   March 21st 2012, 9:20 am

worksapc? Anyway, thats cool. I didn't really know what the whole point of return even was... I thought it would just like... reset the function of something...
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Refering to functions as objects?   March 23rd 2012, 2:42 am

whoops, typo i mean to say Workspace

return has many uses... i was just showing how it returns values from functions because you were wondering. i could explainmore if u wanted.

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Re: Refering to functions as objects?   March 23rd 2012, 12:58 pm

Ok. What else can it do? I think I heard it can like return to the beginning of a function if the requirements can't be met.... btw Have you ever used tweening?
Back to top Go down
blueymaddog
Administrator
Administrator
avatar

Posts : 1081
Join date : 2010-12-09
Age : 19

PostSubject: Re: Refering to functions as objects?   March 28th 2012, 5:03 am

nope, :P first time i tried it it didn't work so I used my own method that was slower :P

_________________
blueymaddog
Administrator • Moderator • Expert Scripter
PM: blueymaddog
<+1 post. ujelly?>
Back to top Go down
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Re: Refering to functions as objects?   March 28th 2012, 11:28 am

XD
Back to top Go down
Sethalonian
Intermediate Scripter
Intermediate Scripter
avatar

Posts : 63
Join date : 2011-06-10
Age : 19

PostSubject: Re: Refering to functions as objects?   March 28th 2012, 11:29 am

Ok, Answer me this, How do you get text to slide out of a gui without moving outside of it, and not showing text or anything? I don't understand it...
Back to top Go down
Sponsored content




PostSubject: Re: Refering to functions as objects?   

Back to top Go down
 
Refering to functions as objects?
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» CAW and BUILD/BUY Unlocked Objects
» Running Hotel Romanstein 6: Last Christmas In DOS
» [HELP] Static Objects
» Create a semitransparent object - Creare un oggetto semitrasparente
» Random Pictures

Permissions in this forum:You cannot reply to topics in this forum
A Roblox Community :: Questions and Help :: Scripting-
Jump to: