Changing Model Skins with LUA?

So I’ve been thinking of something I want to try, but I don’t know of the specific way of doing it in LUA. I want to use “$texturegroup” via LUA. I know there’s a way to do it cause I saw an STOOL do it once, but I would like it if someone could help me out a bit. I specifically want to use this for changing view model/world model texture skins. (Think multiple weapon camouflage variants, etc. that can change in real-time.)