built in functions just not working?
I've noticed this for a while now but some functions just don't work sometimes?
For some reason I keep getting the error 'Warning: random.next() is not a function'..
meth = object end
meth.random = function(minimum, maximum)
local rand = random.next() // error here
return rand * (maximum-minimum) + minimum
end
meth.randomInteger = function(minimum, maximum)
local rand = random.next() // and error here
return floor(rand * (maximum-minimum) + minimum)
end
You should have something like an object initialization function mathInit()
mathInit = function()
meth = object end
meth.random = function(minimum, maximum)
local rand = random.next() // error here
return rand * (maximum-minimum) + minimum
end
meth.randomInteger = function(minimum, maximum)
local rand = random.next() // and error here
return floor(rand * (maximum-minimum) + minimum)
end
end
or place this code in the init() section.
init = function()
mathInit()
end
still doesnt't seem to work..
here's the project in its entirety: https://microstudio.dev/i/gurg0/shapeez/
I just nested the functions in the object instead of on the outside which fixed it?
I really don't know why but at least I solved it cause that was bugging me.