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: anyway to get a functions arguments

Previous Thread :: Next Thread 
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
08 Jul 2016 12:44 PM
is there a way to get a string value containing the functions arguments

for example

function message(text)
print (text)
end

print(message.arguments) --prints "text"

??
Report Abuse
123rhylee is not online. 123rhylee
Joined: 03 Apr 2012
Total Posts: 15
08 Jul 2016 12:49 PM
Why would you ever need that? You pass arguments into a function = you already have the arguments. If you want to edit/do anything with the arguments, you edit the function to do that.
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
08 Jul 2016 12:51 PM
i just wanna print them out of a long table of functions so i can sorta add a description
Report Abuse
123rhylee is not online. 123rhylee
Joined: 03 Apr 2012
Total Posts: 15
08 Jul 2016 12:54 PM
Are you looking instead for a function's return value? You could just make all those functions return something, assign them to variables/added to an array and concatenate the strings together.
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
08 Jul 2016 12:57 PM
no I'm just trying to make a list of all my functions that are in a module script but when you print a list of the functions it only prints the function name and not its arguments so i would have to individually type all of them which is fine but it would be easier to update it if i could somehow get the arguments
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
08 Jul 2016 01:05 PM
--module
local module = {
['FunctionA'] = function(argument)
print(argument)
end
}

return module



--script

local tableOfFunctions = require(modulehere)
for i,v in next(tableOfFunctions) do
print(i)
end





- Isosta
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
08 Jul 2016 01:06 PM
change the for loop to this, i used ipairs syntax mb


for i,v in next, tableOfFunctions do
print(i)
end


- Isosta
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
08 Jul 2016 01:06 PM
that only prints the functions name I'm trying to also print the functions arguments
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
08 Jul 2016 01:07 PM
whatever you're doing is inefficient and a horrible method.


- Isosta
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
08 Jul 2016 01:08 PM
lol what
Report Abuse
Isosta is not online. Isosta
Joined: 10 May 2015
Total Posts: 14729
08 Jul 2016 01:09 PM
if you must, though, pass another argument like this

local message = function(text,bool)
if bool then
return {'text'}
else
--run the function
end
end

local arguments = message('',true)
for i,v in ipairs(arguments) do
print(v)
end



you'd have to add the arguments into the return yourself.


- Isosta
Report Abuse
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
08 Jul 2016 01:14 PM
ok thanks for helping
i was pretty sure it wouldn't work out well anyways :P
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