KoreanBBQ
|
  |
| Joined: 06 Mar 2015 |
| Total Posts: 1436 |
|
|
| 11 Aug 2015 12:41 PM |
Other than something like,
local tableA={4,66,788,0} for i,v in pairs(tableA) if v==0 then print("found 0") end end
~TreeBranch, Owner of Lady of the Federation x2+ Crown of Roses |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2015 12:50 PM |
| I think u did it easy enough, why? |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2015 01:01 PM |
This is the Easiest way to do this type of thing.
InsidersNetwork1001 : Reskin Maker #NOFLOOR #DYNABLOX #NODEVENTS |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 11 Aug 2015 01:05 PM |
local function getVal(tab, val) for i, v in pairs(tab) do if v == val then return true end end return false end
local tab = {"yolo", 1337, "yos", workspace.Part}
if getVal(tab, workspace.Part) then print("yes") else print("no") end |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 Aug 2015 01:26 PM |
| Psst use rawequal it's more reliable |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
| |
|
|
| 11 Aug 2015 01:32 PM |
| Don't do it! Don't use rawequal. |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 11 Aug 2015 01:50 PM |
| Because you're searching for a value in a table, not something that has an equivalence. |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 11 Aug 2015 01:52 PM |
k then
local function getVal(tab, val) for i, v in pairs(tab) do if rawequal(v,val) then return true end end return false end
local tab = {"yolo", 1337, "yos", workspace.Part}
if getVal(tab, workspace.Part) then print("yes") else print("no") end |
|
|
| Report Abuse |
|
|
KoreanBBQ
|
  |
| Joined: 06 Mar 2015 |
| Total Posts: 1436 |
|
|
| 11 Aug 2015 03:11 PM |
Eh thought there would be something simplified like table.find() or i dont know what i was looking for
~TreeBranch, Owner of Lady of the Federation x2+ Crown of Roses |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2015 03:12 PM |
"table.find"
this is when warspy enters and tells about his module. |
|
|
| Report Abuse |
|
|
lostend
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 8265 |
|
|
| 11 Aug 2015 03:28 PM |
function tabFind(tab,val) return table.concat(tab,' '):match(insertstringpatternhereo3o)~=nil end |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2015 03:29 PM |
| well unfortunately roblox wont be adding useful functions like those |
|
|
| Report Abuse |
|
|
rayk999
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 4705 |
|
|
| 11 Aug 2015 03:30 PM |
| Psst, warspy, perfect time to advertise |
|
|
| Report Abuse |
|
|
instawin
|
  |
| Joined: 04 Jun 2013 |
| Total Posts: 8777 |
|
|
| 11 Aug 2015 03:32 PM |
why should they add them when it takes less than a minute to make them yourself either way yeah, warspy's ExtendedTable module is awesome. |
|
|
| Report Abuse |
|
|
|
| 11 Aug 2015 03:38 PM |
| ^ That's not a valid argument |
|
|
| Report Abuse |
|
|