Hi, can someone explain me the correct way of using engine_getvar()?

Code:
long typ;
my.material = engine_getvar("mat_model",&typ);


after using it MY entity turns black if it's a model, or gets a dark texture if it's a terrain. i guess my code is completely wrong