-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetuid.lua
More file actions
36 lines (28 loc) · 910 Bytes
/
getuid.lua
File metadata and controls
36 lines (28 loc) · 910 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--
-- getuid.lua -- Get a Unique ID
--
-- Graciouslly donated to the Public Domain
--
-- Usage:
-- local AppID = "com.yoursite.yourapp"
-- local guid = require("getuid").getuid(AppID)
--
-- Assumptions: Any use of a UDID is for some use online. If your app isn't
-- talking to a server somewhere, there is no need to uniquly ID your app.
-- Of course this won't work for things that are trying to get the UDID in the
-- first place, like PubNub, Push Notifications, etc. but it should provide a
-- solution for your use.
module(..., package.seeall)
local http = require("socket.http")
local json = require("json")
function getuid(appid)
local r, e
local result
print("appid", appid)
r, e = http.request("http://omnigeekmedia.com/api/getuid.php?appid=" .. appid)
if e == 200 then
result = json.decode(r)
return result.uid
end
return nil,result.message
end