diff options
| author | Lua Team <team@lua.org> | 2004-09-21 12:00:00 +0000 |
|---|---|---|
| committer | repogen <> | 2004-09-21 12:00:00 +0000 |
| commit | d8fd22e11b391cf183068049bebbee9702c8f78f (patch) | |
| tree | 12d2fd56e51ab38e8ad660c34aca2975d1a273ea /src/lua/README | |
| parent | 5d480731503a315eab9d6ab9426e3d4cfd5e52f8 (diff) | |
| download | lua-github-5.1-work2.tar.gz | |
Lua 5.1-work25.1-work2
Diffstat (limited to 'src/lua/README')
| -rw-r--r-- | src/lua/README | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/lua/README b/src/lua/README index 1bd07af6..525f6c15 100644 --- a/src/lua/README +++ b/src/lua/README @@ -8,13 +8,19 @@ Usage: lua [options] [script [args]]. Available options are: -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 (almost) unmodified, as follows: +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) @@ -22,11 +28,14 @@ then you can use this interpreter (almost) unmodified, as follows: 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) to be "openstdlibs(L)+myinit(L)". - Here, openstdlibs is a function in lua.c that 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. +* 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). -* Finally, remember to link your C code when building lua. +Just remember to link your C code when building lua! -For other customizations, see ../../etc/config.c. +For other customizations, see ../../include/luaconf.h . |
