Andy Gilbert Posted March 8, 2013 Share Posted March 8, 2013 When i try to call Math:Random i get: Script Error, attempt to call method 'Random' (a nil value). All other math functions seem ok. Andy The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
Andy Gilbert Posted March 8, 2013 Author Share Posted March 8, 2013 From the goblinAI i see it you use Math:rnd()? is this the correct function and the doc's are incorrect? Andy The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do. Leadwerks Game-Ready 3D Models:https://sellfy.com/gib3d Link to comment Share on other sites More sharing options...
tjheldna Posted March 8, 2013 Share Posted March 8, 2013 Yeah I noticed the difference for Random in the doc's and rnd in code. I have tested rnd it and it does indeed calculate a random number. Link to comment Share on other sites More sharing options...
beo6 Posted March 9, 2013 Share Posted March 9, 2013 i am not really sure how to access constans in Lua because i had problems accessing local pi = Math.Pi but i found that "math.pi" works. Maybe that part of the documentation is C++ only because there is no Lua example? Edit: tested the included lua math class and math.randomseed( Time:Millisecs() ) math.random() works too. That way you could at least also use your own random seed if you need to. Link to comment Share on other sites More sharing options...
Josh Posted April 2, 2013 Share Posted April 2, 2013 Confirmed. My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted April 2, 2013 Share Posted April 2, 2013 Fixed. My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts