I was wondering if someone can explain to me what pcall
is used for, like what does it do?
Here's how to use pcall: (and of course its setup to fail....)
Change NILVALUE to "HI" for fail to be false and get the success message to print .
local NILVALUE = nil local success, fail = pcall(function() print("this is a test") print("Concatenate a value: "..NILVALUE) end) if fail then print("Failure: "..fail) -- your failure reason will be here return end print("we succeeded!!!")
PCall Is a way to check errors in functions without breaking the script. This is widely used for debugging. It has 2 arguements, (true,error) if true is false then error message will be tjhe error in the script.