Marcousik Posted April 23, 2018 Posted April 23, 2018 Hello ! What about os.time() ? I was able to use this for randomseed() and it compiled good, now comes an error... I tried os:time() but it did not succeed too thx for help/ideas ! Quote
macklebee Posted April 23, 2018 Posted April 23, 2018 os.time works but it requires that lua sandbox be disabled. If you are trying to get a number to use with randomseed() and random(), try using Time:Millisecs() as it doesn't require lua sandbox to be disabled. On a side note: os.date seems to be more user friendly if anyone is trying to obtain time in hours/minutes/seconds... https://www.lua.org/pil/22.1.html window = Window:Create("CLOCK",0,0,500,500,Window.Titlebar+Window.Center) context = Context:Create(window) world = World:Create() camera = Camera:Create() light = DirectionalLight:Create() light:SetRotation(30,35,0) box1 = Model:Box() box1:SetPosition(0,0,1.5) box1:SetColor(1,0.5,0,1) while not window:KeyHit(Key.Escape) do if window:Closed() then return false end box1:Turn(0,Time:GetSpeed()*0.5,0) Time:Update() world:Update() world:Render() local temp = os.time() context:SetBlendMode(Blend.Alpha) context:DrawText(os.date("%I:%M:%S"),2,2) context:DrawText(temp,2,22) context:DrawText(os.date("%X", temp),2,42) context:SetBlendMode(Blend.Solid) context:Sync(true) end 1 1 Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.