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: Calling a function with a variable?

Previous Thread :: Next Thread 
KarthonTulliusEnnius is not online. KarthonTulliusEnnius
Joined: 30 May 2010
Total Posts: 230
27 May 2016 01:39 PM
function a()
end

function b()
end

function c()
end

math.randomseed(tick())
local p = math.random(3)
local command
if p==1 then
command = a
command()
elseif p==3 then
command = b
command()
else
command = c
command()

I understand this would be inefficient, but do the mechanics work? can you use a variable with the same name as a function to call a function? how?
Report Abuse
KarthonTulliusEnnius is not online. KarthonTulliusEnnius
Joined: 30 May 2010
Total Posts: 230
27 May 2016 01:42 PM
I forgot the end, ignore that, I am more worried about the variable function part, is that possible?
Report Abuse
KarthonTulliusEnnius is not online. KarthonTulliusEnnius
Joined: 30 May 2010
Total Posts: 230
27 May 2016 01:52 PM
bump
Report Abuse
KapKing47 is not online. KapKing47
Joined: 09 Sep 2012
Total Posts: 5522
27 May 2016 01:54 PM
It's supposed to work.
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