of     1   

[rfa#hidefromsearch]
#95006701Monday, April 15, 2013 11:23 PM GMT

[rfa#hidefromsearch]
Dr01d3k4
#95007173Monday, April 15, 2013 11:27 PM GMT

while not Item do wait(0) print("Waiting for ...") end Mine: repeat wait(); until (item); local function FunctionName(ArgumentOne, ArgumentTwo, ArgumentThree) return {ArgumentOne, ArgumentTwo, ArgumentThree} end Mine (assuming this is what you're doing) local function table.pack(...) return {...}; end Though I prefer moonscript: table.pack = (...) -> {...} lib.FunctionName = FunctionName lib.functionName = FunctionName lib.function_name = FunctionName Mine: lib.functionname = functionName; setmetatable(lib, { __index = function (_, ind) local i = ind:gsub("_", ""):lower(); if (lib[i]) then return lib[i]; else error(ind.." is not a valid member of lib"); end end; });
BlueTaslem
#95007293Monday, April 15, 2013 11:28 PM GMT

None of those are algorithms?
Tenal
#95008047Monday, April 15, 2013 11:35 PM GMT

^
ColorfulBody
#95009288Monday, April 15, 2013 11:45 PM GMT

@BlueTaslem That's exactly what I thought. _________________________________________________________________________ I possess 4 ROBUX and 164 tickets.
awsumpwner27
#95010686Monday, April 15, 2013 11:56 PM GMT

closed as not a real question
8SunTzu8
#95013704Tuesday, April 16, 2013 12:22 AM GMT

lol An algorithm checks all possibilities to decide the "best" solution to a problem. I use algorithms for anti-TK situations and such. (Decide if a player should take damage or not, depending on the team of the shooter and the target's team). Allied teams do not hurt one another, neutral cannot hurt or be hurt by any other team. Etc... Anyway, these are all nifty functions, though. Don't they have a ":WaitForChild()" method now? (I can never seem to get it to work). Philosopher, Creator, Clanner, Wiki Writer, and Student
BlueTaslem
#95016511Tuesday, April 16, 2013 12:45 AM GMT

No... It doesn't... What you're defining is similar to a cost function or heuristic... An algorithm is a procedure to arrive at a desired result. Your "algorithm" for team-attack detection would be so trivial no one would ever call it a "procedure," just a condition.
8SunTzu8
#95017543Tuesday, April 16, 2013 12:53 AM GMT

It goes through various checks for some values, and you use tables within a table for your inputs, along with the players and their teams. It's more complicated than: if player.TeamColor == target.TeamColor then return end Also, a heuristic is entirely different. With heuristics, the computer or program must learn from the past to arrive at solutions faster, but it only "estimates" a solution, but it can arrive at said conclusion much faster by checking less paths, or by not checking paths that it knows will not lead to fruition. An algorithmic approach on the other hand will check all possibilities and return the best possible solution. (Which might be your desired result). It's much slower, but typically easier to program. Heuristics and Algorithms are mutually exclusive. Philosopher, Creator, Clanner, Wiki Writer, and Student
kirkyturky12
#95021262Tuesday, April 16, 2013 1:23 AM GMT

function GetTableIndex(Tab,Val,Func)    for i,v in pairs(Tab) do       if Func then          v = Func(v)       end       if v == Val then          return i       end    end end Example: local Table = {"JoHnNy","BiLlY","BoB"} print(GetTableIndex(Table,"billy",string.lower)) -- This should print 2. Oh, and, reported for spam.
[rfa#hidefromsearch]
#95031866Tuesday, April 16, 2013 3:01 AM GMT

[rfa#hidefromsearch]
awsumpwner27
#95032770Tuesday, April 16, 2013 3:12 AM GMT

I just read a definition of algorithm, I must now reveal my own. "An explicitly defined procedure designed to solve a problem where the parameters of the problem tend to vary." Examples of potential names for algorithms: -How to solve a maze even if you've never seen a maze before -How to build a rocking chair no matter who you are -How to eat crab legs with a spork or a ladle -How to math if calculator won't math
[rfa#hidefromsearch]
#95034626Tuesday, April 16, 2013 3:41 AM GMT

[rfa#hidefromsearch]
awsumpwner27
#95035701Tuesday, April 16, 2013 4:04 AM GMT

It didn't have a point, I was just sharing something. It's a personal definition.
BAUER102
#95044691Tuesday, April 16, 2013 11:54 AM GMT

I generally use for i, v in next, table do       -- This does execute faster than pairs end Also, I do often use while true do       local delta = wait(0)       -- Do stuff with the delta end
thedestroyer115
#95047429Tuesday, April 16, 2013 1:24 PM GMT

I use repeat wait() until object everytime, and it works. Could you explain your problem a little more Quenty?
Dr01d3k4
#95052021Tuesday, April 16, 2013 3:37 PM GMT

--> repeat wait(); until (item); Rather bothers me, because you're waiting even if the object exists. That's why I use a while loop. :/ repeat until (item and wait()); Unless Lua expects something between repeat and until, I'm not sure.
awsumpwner27
#95075935Tuesday, April 16, 2013 9:53 PM GMT

A having lack of expected statements is valid.
Dr01d3k4
#95076619Tuesday, April 16, 2013 9:59 PM GMT

^ Took a bit to undertand what you meant :P
StealthKing95
#95080637Tuesday, April 16, 2013 10:36 PM GMT

Quenty i've had the same thing with repeat-loops waiting for objects.
StealthKing95
#149036477Sunday, November 02, 2014 2:08 PM GMT

I know this is necrobumped.. but "while not Item do wait(0) print("Waiting for ...") end" why not just itemsParent:WaitForChild("item")
Fluffmiceter
#149036815Sunday, November 02, 2014 2:15 PM GMT

^ If you look at the KO - WO leaderboard script that the admins made a long time ago, you see that they didn't use object:WaitForChild() because WaitForChild wasn't a method back then. They later realized that it would be helpful to have that method, so they added it. I'm pretty sure the method was added earlier than 2013, but it may have not been known.

    of     1