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 » Scripting Helpers
Home Search
 

Re: problem with recursion

Previous Thread :: Next Thread 
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 10:48 AM
this script is for find the factory in a tycoon when we don't know where we are and where the factory is

function find(what, where)
if string.lower(what) == string.lower(where.Name) then print(where) return end
find(what, where.Parent)
end

local fff = find('Factory',script)
print(fff)

-- OUTPUT --
Factory
nil

the return don't works???
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 10:51 AM
oups, coy/paste error

if string.lower(what) == string.lower(where.Name) then print(where) return where end

still an error
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 May 2013 10:56 AM
You are trying to print script.
Can't do that.
You need to print script.Name.
So your code is
if what==where.Name then return(where.Name)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
20 May 2013 10:57 AM
Or, if you are trying to print it's location:
return where:GetFullName()
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 10:57 AM
found the error : remplacing find(what, where.Parent) by return find(what, where.Parent) works
Report Abuse
bigdaddy92 is not online. bigdaddy92
Joined: 17 Jan 2010
Total Posts: 1684
20 May 2013 11:07 AM
I tried for about 15 minutes, to reply to this, but ROBLOX is ignorant, and blocked my code, when it contains nothing against the rules in it...

-bigdaddy92
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 11:15 AM
oh, but i can't make operation with it

like returning the ownerName, i got an error
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 11:20 AM
bump
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 11:33 AM
bump
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 11:53 AM
bump
Report Abuse
pogo1233456789 is not online. pogo1233456789
Joined: 17 Dec 2009
Total Posts: 142
20 May 2013 12:07 PM
bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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