Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- This is free and unencumbered software released into the public domain.
- Anyone is free to copy, modify, publish, use, compile, sell, or
- distribute this software, either in source code form or as a compiled
- binary, for any purpose, commercial or non-commercial, and by any
- means.
- Read the full license on ( http://unlicense.org )
- Original code made by Rph
- ]]--
- local api = {}
- function api.convert( nValue )
- local unit = " J"
- if nValue > 999 and nValue < 1000000 then
- unit = " KJ"
- return math.floor(nValue / 1000) .. unit
- elseif nValue > 999999 and nValue < 1000000000 then
- unit = " MJ"
- return math.floor(nValue / 1000000) .. unit
- elseif nValue > 999999999 then
- unit = " GJ"
- return math.floor(nValue / 1000000000) .. unit
- else
- return nValue .. unit
- end
- return "Wot"
- end
- return api
Advertisement
Add Comment
Please, Sign In to add comment