1
-------------------------------------------------------------------
18
-------------------------------------------------------------------
24
-- call -> protect(f, err)
31
-- getargs = Main.getargs ??
36
if not f then print(err); return end
38
if not a then print(b); return nil
43
function dostring(s) return do_(loadstring(s)) end
44
-- function dofile(s) return do_(loadfile(s)) end
46
-------------------------------------------------------------------
50
foreachi = tab.foreachi
56
-------------------------------------------------------------------
60
getlocal = dbg.getlocal
61
setcallhook = function () error"`setcallhook' is deprecated" end
62
setlinehook = function () error"`setlinehook' is deprecated" end
63
setlocal = dbg.setlocal
65
-------------------------------------------------------------------
69
acos = function (x) return math.deg(math.acos(x)) end
70
asin = function (x) return math.deg(math.asin(x)) end
71
atan = function (x) return math.deg(math.atan(x)) end
72
atan2 = function (x,y) return math.deg(math.atan2(x,y)) end
74
cos = function (x) return math.cos(math.rad(x)) end
89
randomseed = math.randomseed
90
sin = function (x) return math.sin(math.rad(x)) end
92
tan = function (x) return math.tan(math.rad(x)) end
94
-------------------------------------------------------------------
108
-------------------------------------------------------------------
112
difftime = os.difftime
113
execute = os.execute --?
118
setlocale = os.setlocale
122
-------------------------------------------------------------------
123
-- compatibility only
124
getglobal = function (n) return _G[n] end
125
setglobal = function (n,v) _G[n] = v end
127
-------------------------------------------------------------------
129
local io, tab = io, table
131
-- IO library (files)
137
seek = io.stdin.seek -- sick ;-)
148
function readfrom (name)
150
local f, err, cod = io.close(_INPUT)
154
local f, err, cod = io.open(name, "r")
160
function writeto (name)
162
local f, err, cod = io.close(_OUTPUT)
166
local f, err, cod = io.open(name, "w")
167
_OUTPUT = f or _OUTPUT
172
function appendto (name)
173
local f, err, cod = io.open(name, "a")
174
_OUTPUT = f or _OUTPUT
180
if rawtype(arg[1]) == 'userdata' then
181
f = tab.remove(arg, 1)
183
return f:read(unpack(arg))
188
if rawtype(arg[1]) == 'userdata' then
189
f = tab.remove(arg, 1)
191
return f:write(unpack(arg))