Yes. I uderstand this goal. I mean some another point
In case of require in avery file i need to do it every time
In init i can do require at once and then use these functions in every client connect.
The root of question is: is it bad practice and if yes i want to understand why.
суббота, 22 апреля 2017 г., 16:10:10 UTC+3 пользователь Yuriy Gorlichenko написал:
Hi. I implementing some conde for now and thinking how is better to initialize libs
I always did
local this= require "that"
in every script but always thinking about require-one-time operations
I thought about use some golbal table for describe required libs like
modules = {
this =require "that"
}
I tried it. IT works fine
But also i read about that it is not good to use global vars in openresty.
So my question is how to do better and if need to avoid global variables in this case - why?
THank you for response