Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Creator: Bolodefchoco
- --Made in: 10/01/2016
- --Last update: 25/05/2016
- --[[ Notes:
- Does:
- Realiza a transformação de um grau para outro (Celcius, Fahrenheit, Kelvin)
- ]]--
- adm = "Bolodefchoco" ----<---- Seu Nickname
- local from,to
- local id = 0
- spawn=function(i)
- for x = i,i do
- for k,v in next,{i<2 and "From" or "To","Celcius","Fahrenheit","Kelvin"} do
- id = id + 1
- if from ~= v:sub(1,1):lower() then
- local t = i==1 and "_" or "@"
- ui.addTextArea(id,("<p align='center'><font size='14'><%s><a href='event:%s'>%s"):format(k==1 and "J" or "VP",t..v:sub(1,1):lower(),k==1 and "</a>"..v or v),adm,(i*150) - 135,k*40,100,25)
- end
- end
- end
- end
- eventTextAreaCallback=function(i,n,c)
- if c ~= "new" then
- if c:sub(1,1) == "_" and not from then
- from = c:sub(2)
- spawn(2)
- end
- if c:sub(1,1) == "@" and not to then
- to = c:sub(2)
- end
- if to and from then
- ui.addPopup(0,2,"Number below",n,320,50,100)
- end
- else
- from,to = nil,nil
- for i = -1,id do ui.removeTextArea(i,n) end
- spawn(1)
- end
- end
- eventPopupAnswer=function(i,n,a)
- local temp={}
- temp.ck = function(x)
- return tostring(math.floor(x) + 273).." K"
- end
- temp.fk = function(x)
- return tostring(x-32/1.8 + 273.15).." K"
- end
- temp.cf = function(x)
- return tostring(x*1.8+32).." °F"
- end
- temp.kf = function(x)
- return tostring((x-273.15)*1.8+32).." °F"
- end
- temp.fc = function(x)
- return tostring((x-32)/1.8).." °C"
- end
- temp.kc = function(x)
- return tostring(x - 273.15).." °C"
- end
- ui.addTextArea(0,"<p align='center'><font size='15'><PT>"..temp[from..to](tonumber(a)),n,320,50,nil,30)
- ui.addTextArea(-1,"<p align='center'><font size='14'><R><a href='event:new'>New transformation",n,320,90,50,20)
- end
- spawn(1)
Add Comment
Please, Sign In to add comment