瀏覽代碼

globals to locals

etisab 10 年之前
父節點
當前提交
3ac376e79b
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      BUILD/sendYo.lua

+ 3 - 3
BUILD/sendYo.lua

@@ -3,16 +3,16 @@ file.open("yorecipient.txt", "r")
 print("sending yo to "..file.readline())
 file.close()
 wifi.sleeptype(wifi.NONE_SLEEP)
+wifi.setmode(wifi.STATION)
 
 function generateContentString()
 	file.open("yorecipient.txt", "r")
 	return "api_token=0c6ac771-71fa-420f-810c-2853989a8ca6&username="..string.upper(file.readline())
 end
 
-wifi.setmode(wifi.STATION)
+local contentString = generateContentString()
+local contentLength = string.len(contentString)
 
-contentString = generateContentString()
-contentLength = string.len(contentString)
 http.post(
 	'https://api.justyo.co/yo/',
 	'Content-Type: application/x-www-form-urlencoded\r\n'..