So far I haven't tried using arrays in a script and I wanted to use one in a function, however the following code returns a error, any reason why?
Code |
---|
function prepare()
end;
function mat4({r1,r2,r3,r4})
local matrix = {}
matrix[1], matrix[2], matrix[3], matrix[4] = r1, r2, r3, r4
return matrix[1], matrix[2], matrix[3], matrix[4]
end
function get_sample(x, y)
return mat4({1.0,0.5,0.25,1})
end; |
I'm using FF3, perhaps this is due to the version I am using or maybe a limitation in map scripts? or hopefully just an error in my code.
When using an array in the prepare function it seems to work though.
Code |
---|
function prepare()
matrix = {1.0,0.5,0.25,1.0}
end;
function get_sample(x, y)
return matrix[1],matrix[2],matrix[3],matrix[4]
end; |