forked from mkottman/AndroLua
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathinit.lua
46 lines (38 loc) · 861 Bytes
/
init.lua
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
35
36
37
38
39
40
41
42
43
44
45
46
require 'android.import'
function goapp(mod,arg)
service:launchLuaActivity(activity,mod,arg)
end
function killapp()
-- until we get it right...
--~ if current_activity ~= activity then
--~ current_activity:finish()
--~ end
end
PK = luajava.package
W = PK 'android.widget'
G = PK 'android.graphics'
V = PK 'android.view'
A = PK 'android'
L = PK 'java.lang'
U = PK 'java.util'
IO = PK 'java.io'
N = PK 'java.net'
function load_utils ()
utils = require 'android.utils'
end
async = require 'android.async'
function open ()
c,e = utils.open_socket('146.64.150.144',2220)
if not e then
r = utils.buffered_reader(c:getInputStream())
w = IO.PrintWriter(c:getOutputStream())
else
print('error',e)
end
end
function cmd (msg)
w:println(msg)
w:flush()
return r:readLine()
end
load_utils()