PDA

View Full Version : User.isHost() or Session.IsHost?



peterb
May 9th, 2021, 15:02
Both User.isHost() and Session.IsHost seems to do the same thing. Is one recommended over the other?

/Peter

damned
May 9th, 2021, 15:04
I believe you should generally be using Session.IsHost() now.

peterb
May 9th, 2021, 15:26
I believe you should generally be using Session.IsHost() now.

OK thanks.

Session.isHost is not a function but, I guess, a global variable of sorts and I see both being used in the ruleset I'm using and building an extension for (Basic Roleplaying) so I just wanted to follow a current best practice.

/Peter

Moon Wizard
May 10th, 2021, 06:03
Session.IsHost is a boolean value in a package of variables. The Session package of variables was specifically created to register common variables requested; so that API functions would not need to be called (which take more overhead) (such as User.isHost())

Regards,
JPG

Varsuuk
May 10th, 2021, 07:21
Both continue to exist from what was mentioned previously - but as Moon mentioned, using Session.IsHost (capital I or get errors like I did once ;P) is the better way to go for performance.

FYI, Moon Wizard posted this in response to an earlier ask on the subject:

Session package variables

IsHost [bool]
IsLocal [bool]
VersionMajor [#][X = client release (X.#.#)]
VersionMinor [#][X = client release (#.X.#)]
VersionRelease [#][X = client release (#.#.X)]
CampaignName [string]
RulesetName [string]
UserName [string][FG account name]


Some of these can replace equivalent function calls (perhaps they all do, I haven't used all of the things they replace yet) in other locations like User (sLocal()), etc.