|
| 10 Feb 2017 09:45 PM |
table={ a=23 v=38 hehe="lol" sos=workspace.Part }
for i=1,#table do print(table[i]) end
Al table contents are nil values? what? How do I iterate through a table like this without knowing the variable name? |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 09:47 PM |
for i,v in pairs (table) do
end
???? |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 09:47 PM |
for index, value in pairs(table) do end
iterating through a dictionary with a numerical for loop doesn't work because table[1] doesn't exist; only table[a], table[v] and so on
|
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 09:51 PM |
table={ a=23 v=38 hehe="lol" sos=workspace.Part }
for index, value in pairs(table) do print(table[index]) print(table[value]) end
prints nil... |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Feb 2017 09:53 PM |
for i,v in pairs (table) do print(i) print(v) end
i is the table index, v is the value. |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Feb 2017 10:02 PM |
wait
table={ a={"a","b","c"} b={"d","e","f"} c={"g","h","i"} }
for i,v in pairs (table) do print(table[i][math.random(1,#table[i])])) end
this only prints a,d,g? Never prints b,e,h,c,f,i |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 10:03 PM |
seed the generator with math.randomseed(tick())
|
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 10:13 PM |
| DOESN'T work for some odd reason. It chooses one random character from the subtables, then reuses it again without choosing random, while I instructed it to INDIV={ --ignore the dots, they're just for style O={"o.1","o.2","o.3","o.4","o.5","o.6"}, E={"e.1","e.2","e.3","e.4","e.5","e.6"}} input="OOOOeeeeOOOOOOOooooOOOOOOOOOO" local str=string.upper(input) for i,v in pairs (INDIV) do print(i,INDIV[i][1])--words to replace, replacements if ################## then ################################################## end end output: ################################################################################# |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 10:14 PM |
| You've got to be kidding me, worthless good-for-nothing filter ####### ######################################## ####################################### } input="OOOOeeeeOOOOOOOOOOOOOOOOOOO" local str=string.upper(input) for i,v in pairs (INDIV) do ########################### to replace, replacements if ################## then ################################################## end end ########## OUTPUT: ####################################################################### |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Feb 2017 10:17 PM |
| oh my GOD! WHAT, I'M NOT EVEN SWEARING!!!!!!! I'll send you a link to # model instead, this is hopeless. ############################################# ##### last try ####### ######################################## ######################################## input="eeeeOOOOOOOOOOOOOOOOOOO" local str=string.upper(input) for i,v in pairs (INDIV) do ########################### to replace, replacements if string.find(str,i) then ################################################## end end ########## |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 10:17 PM |
| https://www.roblox.com/library/649598183/same-result-weird |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 10:17 PM |
LOL Sorry man I know it sucks |
|
|
| Report Abuse |
|
|
|
| 10 Feb 2017 10:18 PM |
dude put it in pastebin or something i'm too lazy to go into studio
|
|
|
| Report Abuse |
|
|
| |
|
|
| 10 Feb 2017 10:21 PM |
| I think I know what's going on here. string:gsub replaces them all at once with the same value. How do I change that? |
|
|
| Report Abuse |
|
|