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: getting all combinations

Previous Thread :: Next Thread 
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 11:32 AM
function getCombinations(tab,length)
local combos={}
for i=1,#tab^length do
end
end

thats all i have ):
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 11:38 AM
1
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 11:57 AM
2
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
12 Aug 2015 12:03 PM
All combinations of?
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
12 Aug 2015 12:06 PM
Do you wan the COMBINATIONS or the PERMUTATIONS of said table

Those are usually mixed up
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 12:07 PM
i thought it would be obvious just by looking at the function, but here:
tab is a table of characters
length is the length the possibilities can be

getAllPossibilities({'a','b','c','d},3)

Should return all possible combos that are 3 characters long
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
12 Aug 2015 12:08 PM
4 nPr 3
or
4 nCr 3

Probably the second one based on your post.
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 01:07 PM
wat
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 01:17 PM
bump
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
12 Aug 2015 01:19 PM
nPr and nCr are functions on scientific calculators

just remake it into a function
search it uppp
Report Abuse
rayk999 is not online. rayk999
Joined: 18 Feb 2011
Total Posts: 4705
12 Aug 2015 01:24 PM
I thought he wanted a table of strings that are possible combinations. The function on the calculator returns a number that shows how much combinations there are
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 01:29 PM
ok, I have a table with possible characters, and the length is the length each combo has to be
if len is 3, each combo is 3 characters long. it gets those characters from the table
Report Abuse
lostend is not online. lostend
Joined: 21 Aug 2011
Total Posts: 8265
12 Aug 2015 01:40 PM
function getCombos(tab,len)
local chars={}
local combos={}
for i=1,len do
for d,v in next,tab do
chars[#chars+1]=tab[d]
end
end
local e=#chars
for i=1,e do
local ran={}
for o=1,len do
local r=math.random(1,#chars)
ran[#ran+1]=r
chars[r]=nil
end
end
return chars
end
print(table.concat(getCombos({'a','b'},3),' '))

This is what I have now, but it errors. However, if I remove line 15, it works?

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