summaryrefslogtreecommitdiff
path: root/src/lua/README
blob: 525f6c15448c7a2ea97087cf8893fa8ece041152 (plain)
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
This is lua, the stand-alone Lua interpreter.
It can be used as a batch interpreter and also interactively.
There are man pages for it in both nroff and html in ../../doc.

Usage: lua [options] [script [args]].  Available options are:
  -        execute stdin as a file
  -e stat  execute string `stat'
  -i       enter interactive mode after executing `script'
  -l name  load and run library `name'
  -v       show version information
  -w       catch use of undefined global variables
  --       stop handling options

This interpreter is suitable for using Lua as a stand-alone language; it loads
all standard libraries. For a minimal interpreter, see ../../etc/min.c.

If your application simply exports new functions to Lua (which is common),
then you can use this interpreter unmodified by putting your functions into
a library and loading it dynamically (if you have built support for dynamic
libraries).

If you need to add your library statically, then you can use this interpreter
almost unmodified, as follows:

* First, define a function 
	 void myinit (lua_State *L)
  in your own code. In this function, you should do whatever initializations
  are needed by your application, typically exporting your functions to Lua.
  (Of course, you can use any name instead of "myinit".)

* Then, #define lua_userinit(L) in luaconf.h to call luaopen_stdlibs and
  possibly luaopen_stdlibs, which opens all standard libraries. If you don't
  need them, just don't call openstdlibs and open any standard libraries that
  you do need in myinit.

* Alternatively, write your own luaopen_stdlibs; the linker will use your
  version (if you ask politely).

Just remember to link your C code when building lua!

For other customizations, see ../../include/luaconf.h .