I guess you can load objects using a function, although I can't think why you'd want to, as it's easily done in one short command. I guess if you wanted to load several objects and manipulate them in some way, it would be something like this:
load_object(number,filename,scale,texture,diffuse,etc.)
function load_object(number,filename,scalexyz,texture,diffuse,etc.)
load object number,filename
scale object number,scalexyz,scalexyz,scalexyz
texture object number,texture
set object diffuse object,diffuse
etc.
endfunction
Any variables defined in the function that you want global outside of the function need to be declared as globals from inside the function - ie.
function whatever
global speed#
etc.
endfunction