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: Is there any way to pass an argument through a function...

Previous Thread :: Next Thread 
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
09 Jul 2015 09:47 PM
that has an event?

function printthis (msg)
print (msg)
end

workspace.Tool.Activated:connect (printthis,"hi")

would that work?

Hello World!
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
09 Jul 2015 10:16 PM
workspace.Tool.Activated:connect(function() printthis("hi") end)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2015 10:20 PM
function func(...)
local args = {}
local custom = args[#args]
print(custom)
end

workspace.Tool.Activated:connect(function(...)
func(..., "hi")
end)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2015 10:21 PM
My bad, fixed

function func(...)
local args = {}
local custom = args[1]
print(custom)
end

workspace.Tool.Activated:connect(function(...)
func("hi", ...)
end)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
09 Jul 2015 10:21 PM
Ugh hold on, now it's fixed XD


function func(...)
local args = {...}
local custom = args[1]
print(custom)
end

workspace.Tool.Activated:connect(function(...)
func("hi", ...)
end)
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
09 Jul 2015 10:24 PM
I didn't see the OP ask for the arguments from the event too.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
09 Jul 2015 10:35 PM
There is no parameter given from the event. It also had to be anonymous



Hello World!
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
09 Jul 2015 10:36 PM
*named, not anonymous



Hello World!
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
09 Jul 2015 10:36 PM
No it doesn't.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
09 Jul 2015 10:38 PM
hmm, perhaps you're right



Hello World!
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