Ulysses Stuff > General Chat & Help and Support

What does this piece of code do?

(1/1)

iitiago:
I'm learning lua so I'm studying gmod lua addons and found this piece of code. What does this do exactly? and what does it return?

--- Code: ---local function hasAccess(ply)
if ulx then
return ply:query("ulx seeasay")
end

--- End code ---

MrPresident:
ply:query is checking ULib to see if the player (represented by ply here) has the "ulx seeasay" permission flag.
The rest of the code is just wrapping our permission check function inside of another function, presumably so they can support multiple admin mods if needed.

iitiago:

--- Quote from: MrPresident on September 27, 2019, 05:38:22 PM ---ply:query is checking ULib to see if the player (represented by ply here) has the "ulx seeasay" permission flag.
The rest of the code is just wrapping our permission check function inside of another function, presumably so they can support multiple admin mods if needed.

--- End quote ---

Thank you so much!

JamminR:
litiago, and if it's not obvious, 'query' is not a standard Lua, or Gmod lua function.
It's part of our Ulysses Library (ULib)
Documented here - https://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html#ucl.query

Navigation

[0] Message Index

Go to full version