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
 

What does pcall do?

Previous Thread :: Next Thread 
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
03 Jul 2012 09:03 AM
title.
Report Abuse
Kepie is not online. Kepie
Joined: 12 Nov 2011
Total Posts: 884
03 Jul 2012 09:06 AM
bump
Report Abuse
stuart6854 is not online. stuart6854
Joined: 20 Oct 2008
Total Posts: 913
03 Jul 2012 09:07 AM
Look at wiki
Report Abuse
stuart6854 is not online. stuart6854
Joined: 20 Oct 2008
Total Posts: 913
03 Jul 2012 09:08 AM
pcall

pcall (f, arg1, ···)
Calls function f with the given arguments in protected mode. This means that any error inside f is not propagated; instead, pcall catches the error and returns a status code. Its first result is the status code (a boolean), which is true if the call succeeds without errors. In such case, pcall also returns all results from the call, after this first result. In case of any error, pcall returns false plus the error message.

    if pcall (function() print("Hi Mom!") end) then
      -- Stuff
    else print("There were errors")
    end

 

    if pcall (function() ppppprint("Hi Mom!") end) then
        -- Stuff
    else print("There were errors")
    end

Output: Hi Mom!
        There were errors

NOTE: You cannot use a function that yields the running coroutine in use by pcall. That includes the wait function. You will get an error about not being able to resume a dead coroutine and not being able to yield across the C boundary.
Report Abuse
Ellieb is not online. Ellieb
Joined: 27 Feb 2007
Total Posts: 52
03 Jul 2012 09:11 AM
pcall basically runs the script or function without error, pcall(function() workspace.Mom:remove() print'a' end) if Mom isn't there it would not error, and print a
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