generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Is this inefficient

Previous Thread :: Next Thread 
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
05 Nov 2013 02:43 PM
Its a time converter
Seconds = 100 --Numbers of seconds
Seconds = tonumber(Seconds)
TimeTable = {60, 60, 24}
Seconds2 = Seconds % TimeTable[1]
Minutes = (Seconds - Seconds2) / TimeTable[1]
Minutes2 = Minutes % TimeTable[2]
Hours = (Minutes - Minutes2) / TimeTable[2]
Hours2 = Hours % TimeTable[3]
Days = (Hours - Hours2) / TimeTable[3]
print("Day " .. Days)
print(Hours2 .. ":" .. Minutes2 .. ":" .. Seconds2)
Report Abuse
yoshimaster240102 is not online. yoshimaster240102
Joined: 14 Apr 2012
Total Posts: 470
05 Nov 2013 02:44 PM
To me, no :)
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
05 Nov 2013 03:53 PM
Bump
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
05 Nov 2013 03:57 PM
Seconds = 100 --Numbers of seconds
Seconds = tonumber(Seconds)
TimeTable = {60, 60, 24}
Minutes = math.floor(Seconds/TimeTable[1])
Hours = math.floor(Minutes/TimeTable[2])
Days = math.floor(Hours/TimeTable[3])
print("Day " .. Days)
print(Hours .. ":" .. Minutes .. ":" .. Seconds)

Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
05 Nov 2013 04:01 PM
If Im wrong correct me, all you did was math.floor it all right?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
05 Nov 2013 04:02 PM
Technically it's more efficient, but yeah.
Report Abuse
MHebes is not online. MHebes
Joined: 04 Jan 2013
Total Posts: 2278
05 Nov 2013 04:04 PM
If you really want to squeeze efficiency out of this, make all your variables local and get rid of any tables/table indexing - that's expensive (although not really in this case)
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
05 Nov 2013 04:04 PM
Yeah beebee's is more efficient, but yours is more accurate ._.
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
05 Nov 2013 04:04 PM
Well I didn't really want it to do that :P
But thanks anyway, Anything else I could change? Or is it pretty good as is?
Report Abuse
Scriptural is not online. Scriptural
Joined: 06 Sep 2013
Total Posts: 2979
05 Nov 2013 04:06 PM
local Seconds = 100 --Numbers of seconds
local Seconds = tonumber(Seconds) --I have a reason for this
local Seconds2 = Seconds % 60
local Minutes = (Seconds - Seconds2) / 60
local Minutes2 = Minutes % 60
local Hours = (Minutes - Minutes2) / 60
local Hours2 = Hours % 24
local Days = (Hours - Hours2) / 24
print("Day " .. Days)
print(Hours2 .. ":" .. Minutes2 .. ":" .. Seconds2)


Hows this?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image