Hello,
In a python script, I would like to test if a global var exists.
Something like :
if eg.globals.somevar exists:
eg.TriggerEvent(eg.globals.somevar)
else:
eg.globals.somevar="default"
Can you tell me how to write the bold line ?
Thanks !
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Testing if a global var exists
Testing if a global var exists
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Testing if a global var exists
Code: Select all
if "somevar" in eg.globals.__dict__:
eg.TriggerEvent(eg.globals.somevar)
else:
eg.globals.somevar="default"Re: Testing if a global var exists
thank you !
miljbee
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
TCP Events : A Better Network Event Sender/Receiver Plugin.
The Network Event Sender/Receiver in C#
Get events in EG from Google Calendar.
Re: Testing if a global var exists
Thanks Pako.
I always wondered about this also, but never asked.
I always wondered about this also, but never asked.