Static initializers do not initialize anything
Posted: 13 Sep 2018, 00:14
This method seems straightforward in the docs, but does not work at all as expected
I want to read this file only once, not every time the function is called. Warn always complains that oauth is undefined, why?
Code: Select all
get_oauth() {
static oauth := 0
if !oauth {
fo := FileOpen(a_scriptdir "\oauth", 0)
oauth := fo ? fo.read() : 0
}
return oauth
}