Skip to content

Update variable with tabs count #3181

Answered by wez
pwsandoval asked this question in Q&A
Discussion options

You must be logged in to vote

Each thread, and different execution contexts, may run with a fresh lua state.
As such, you cannot share data by storing it directly in global variables.

You can use https://wezfurlong.org/wezterm/config/lua/wezterm/GLOBAL.html for sharing data in that way.

However, because there can be multiple windows, it doesn't make a lot of sense to try to track the window in any kind of global state.

wezterm always passes the current window to the various event callbacks; you should always use the window parameter that is passed to them when you want to operate on the current window.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@damajor
Comment options

Answer selected by pwsandoval
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants