diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/luajit-2.0/etc/luajit.1 | 85 | ||||
-rw-r--r-- | libraries/luajit-2.0/etc/luajit.pc | 24 | ||||
-rw-r--r-- | libraries/luajit-2.0/etc/strict.lua | 41 |
3 files changed, 150 insertions, 0 deletions
diff --git a/libraries/luajit-2.0/etc/luajit.1 b/libraries/luajit-2.0/etc/luajit.1 new file mode 100644 index 0000000..57080bc --- /dev/null +++ b/libraries/luajit-2.0/etc/luajit.1 | |||
@@ -0,0 +1,85 @@ | |||
1 | .TH luajit 1 "" "" "LuaJIT documentation" | ||
2 | .SH NAME | ||
3 | luajit \- Just-In-Time Compiler for the Lua Language | ||
4 | \fB | ||
5 | .SH SYNOPSIS | ||
6 | .B luajit | ||
7 | [\fIoptions\fR]... [\fIscript\fR [\fIargs\fR]...] | ||
8 | .SH "WEB SITE" | ||
9 | .IR http://luajit.org | ||
10 | .SH DESCRIPTION | ||
11 | .PP | ||
12 | This is the command-line program to run Lua programs with \fBLuaJIT\fR. | ||
13 | .PP | ||
14 | \fBLuaJIT\fR is a just-in-time (JIT) compiler for the Lua language. | ||
15 | The virtual machine (VM) is based on a fast interpreter combined with | ||
16 | a trace compiler. It can significantly improve the performance of Lua programs. | ||
17 | .PP | ||
18 | \fBLuaJIT\fR is API\- and ABI-compatible with the VM of the standard | ||
19 | Lua\ 5.1 interpreter. When embedding the VM into an application, | ||
20 | the built library can be used as a drop-in replacement. | ||
21 | .SH OPTIONS | ||
22 | .TP | ||
23 | .BI "\-e " chunk | ||
24 | Run the given chunk of Lua code. | ||
25 | .TP | ||
26 | .BI "\-l " library | ||
27 | Load the named library, just like \fBrequire("\fR\fIlibrary\fR\fB")\fR. | ||
28 | .TP | ||
29 | .BI "\-b " ... | ||
30 | Save or list bytecode. Run without arguments to get help on options. | ||
31 | .TP | ||
32 | .BI "\-j " command | ||
33 | Perform LuaJIT control command (optional space after \fB\-j\fR). | ||
34 | .TP | ||
35 | .BI "\-O" [opt] | ||
36 | Control LuaJIT optimizations. | ||
37 | .TP | ||
38 | .B "\-i" | ||
39 | Run in interactive mode. | ||
40 | .TP | ||
41 | .B "\-v" | ||
42 | Show \fBLuaJIT\fR version. | ||
43 | .TP | ||
44 | .B "\-\-" | ||
45 | Stop processing options. | ||
46 | .TP | ||
47 | .B "\-" | ||
48 | Read script from stdin instead. | ||
49 | .PP | ||
50 | After all options are processed, the given \fIscript\fR is run. | ||
51 | The arguments are passed in the global \fIarg\fR table. | ||
52 | .PP | ||
53 | Interactive mode is only entered, if no \fIscript\fR and no \fB\-e\fR | ||
54 | option is given. Interactive mode can be left with EOF (\fICtrl\-Z\fB). | ||
55 | .SH EXAMPLES | ||
56 | .TP | ||
57 | luajit hello.lua world | ||
58 | |||
59 | Prints "Hello world", assuming \fIhello.lua\fR contains: | ||
60 | .br | ||
61 | print("Hello", arg[1]) | ||
62 | .TP | ||
63 | luajit \-e "local x=0; for i=1,1e9 do x=x+i end; print(x)" | ||
64 | |||
65 | Calculates the sum of the numbers from 1 to 1000000000. | ||
66 | .br | ||
67 | And finishes in a reasonable amount of time, too. | ||
68 | .TP | ||
69 | luajit \-jv \-e "for i=1,10 do for j=1,10 do for k=1,100 do end end end" | ||
70 | |||
71 | Runs some nested loops and shows the resulting traces. | ||
72 | .SH COPYRIGHT | ||
73 | .PP | ||
74 | \fBLuaJIT\fR is Copyright \(co 2005-2011 Mike Pall. | ||
75 | .br | ||
76 | \fBLuaJIT\fR is open source software, released under the MIT license. | ||
77 | .SH SEE ALSO | ||
78 | .PP | ||
79 | More details in the provided HTML docs or at: | ||
80 | .IR http://luajit.org | ||
81 | .br | ||
82 | More about the Lua language can be found at: | ||
83 | .IR http://lua.org/docs.html | ||
84 | .PP | ||
85 | lua(1) | ||
diff --git a/libraries/luajit-2.0/etc/luajit.pc b/libraries/luajit-2.0/etc/luajit.pc new file mode 100644 index 0000000..974abde --- /dev/null +++ b/libraries/luajit-2.0/etc/luajit.pc | |||
@@ -0,0 +1,24 @@ | |||
1 | # Package information for LuaJIT to be used by pkg-config. | ||
2 | majver=2 | ||
3 | minver=0 | ||
4 | relver=0 | ||
5 | version=${majver}.${minver}.${relver}-beta9 | ||
6 | abiver=5.1 | ||
7 | |||
8 | prefix=/usr/local | ||
9 | exec_prefix=${prefix} | ||
10 | libdir=${exec_prefix}/lib | ||
11 | libname=luajit-${abiver} | ||
12 | includedir=${prefix}/include/luajit-${majver}.${minver} | ||
13 | |||
14 | INSTALL_LMOD=${prefix}/share/lua/${abiver} | ||
15 | INSTALL_CMOD=${prefix}/lib/lua/${abiver} | ||
16 | |||
17 | Name: LuaJIT | ||
18 | Description: Just-in-time compiler for Lua | ||
19 | URL: http://luajit.org | ||
20 | Version: ${version} | ||
21 | Requires: | ||
22 | Libs: -L${libdir} -l${libname} | ||
23 | Libs.private: -Wl,-E -lm -ldl | ||
24 | Cflags: -I${includedir} | ||
diff --git a/libraries/luajit-2.0/etc/strict.lua b/libraries/luajit-2.0/etc/strict.lua new file mode 100644 index 0000000..e57b0cc --- /dev/null +++ b/libraries/luajit-2.0/etc/strict.lua | |||
@@ -0,0 +1,41 @@ | |||
1 | -- | ||
2 | -- strict.lua | ||
3 | -- checks uses of undeclared global variables | ||
4 | -- All global variables must be 'declared' through a regular assignment | ||
5 | -- (even assigning nil will do) in a main chunk before being used | ||
6 | -- anywhere or assigned to inside a function. | ||
7 | -- | ||
8 | |||
9 | local getinfo, error, rawset, rawget = debug.getinfo, error, rawset, rawget | ||
10 | |||
11 | local mt = getmetatable(_G) | ||
12 | if mt == nil then | ||
13 | mt = {} | ||
14 | setmetatable(_G, mt) | ||
15 | end | ||
16 | |||
17 | mt.__declared = {} | ||
18 | |||
19 | local function what () | ||
20 | local d = getinfo(3, "S") | ||
21 | return d and d.what or "C" | ||
22 | end | ||
23 | |||
24 | mt.__newindex = function (t, n, v) | ||
25 | if not mt.__declared[n] then | ||
26 | local w = what() | ||
27 | if w ~= "main" and w ~= "C" then | ||
28 | error("assign to undeclared variable '"..n.."'", 2) | ||
29 | end | ||
30 | mt.__declared[n] = true | ||
31 | end | ||
32 | rawset(t, n, v) | ||
33 | end | ||
34 | |||
35 | mt.__index = function (t, n) | ||
36 | if not mt.__declared[n] and what() ~= "C" then | ||
37 | error("variable '"..n.."' is not declared", 2) | ||
38 | end | ||
39 | return rawget(t, n) | ||
40 | end | ||
41 | |||