Lore archive · Warcraft Wiki, 2023 dump
API pcallwithenv
Last wiki revision 2023-05-02
Calls a function in protected mode with a temporarily replaced function environment. ok, ... = pcallwithenv(func, env, ...)
- func: - The function to be called.
- env: - A custom environment table to apply to the function prior to calling.
- ...:Variable - Arguments to supply to the function.
- ok: - True if the function was called without error.
- ...:Variable - Either a singular error value or all of the return values of the called function.
- This function will temporarily replace the existing environment on the supplied function before the call, and will restore the original environment after the call has completed.
- This function will raise an error if the function to be called has an existing environment whose metatable has an __environment field set.
- If this function is called insecurely and the supplied function is a Lua function, the supplied function will be irrevocably tainted. This will result in all future calls to the function tainting execution.
Source
https://warcraft.wiki.gg/wiki/API_pcallwithenv · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.