From 75fef2621079a262b752b2340646103f54509abb Mon Sep 17 00:00:00 2001 From: Mark Gossage Date: Wed, 12 Dec 2007 01:14:21 +0000 Subject: [PATCH] [lua] update lua.html git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10187 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Doc/Manual/Lua.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/Manual/Lua.html b/Doc/Manual/Lua.html index ba77e8666..3f56be1fc 100644 --- a/Doc/Manual/Lua.html +++ b/Doc/Manual/Lua.html @@ -86,7 +86,7 @@ $ swig -c++ -lua example.i This creates a C/C++ source file example_wrap.c or example_wrap.cxx. The generated C source file contains the low-level wrappers that need to be compiled and linked with the rest of your C/C++ application to create an extension module.

-The name of the wrapper file is derived from the name of the input file. For example, if the input file is example.i, the name of the wrapper file is example_wrap.c. To change this, you can use the -o option. The wrappered module will export one function "int luaopen_example(LuaState* L)" which must be called to register the module with the Lua interpreter. The name "luaopen_example" depends upon the name of the module. +The name of the wrapper file is derived from the name of the input file. For example, if the input file is example.i, the name of the wrapper file is example_wrap.c. To change this, you can use the -o option. The wrappered module will export one function "int luaopen_example(lua_State* L)" which must be called to register the module with the Lua interpreter. The name "luaopen_example" depends upon the name of the module.

22.2.1 Compiling and Linking and Interpreter

@@ -100,7 +100,7 @@ Normally Lua is embedded into another program and will be statically linked. An #include "lualib.h" #include "lauxlib.h" -extern int luaopen_example(LuaState* L); // declare the wrapped module +extern int luaopen_example(lua_State* L); // declare the wrapped module int main(int argc,char* argv[]) { @@ -125,10 +125,10 @@ int main(int argc,char* argv[]) A much improved set of code can be found in the Lua distribution src/lua/lua.c. Include your module, just add the external declaration & add a #define LUA_EXTRALIBS {"example",luaopen_example}, at the relevant place.

-The exact commands for doing this vary from platform to platform. Here is a possible set of commands of doing this: +The exact commands for compiling and linking vary from platform to platform. Here is a possible set of commands of doing this:

-$ swig -lua example.i
+$ swig -lua example.i -o example_wrap.c
 $ gcc -I/usr/include/lua -c min.c -o min.o
 $ gcc -I/usr/include/lua -c example_wrap.c -o example_wrap.o
 $ gcc -c example.c -o example.o
@@ -142,7 +142,7 @@ $ gcc -I/usr/include/lua -L/usr/lib/lua min.o example_wrap.o example.o -o my_lua
 Most, but not all platforms support the dynamic loading of modules (Windows & Linux do). Refer to the Lua manual to determine if your platform supports it. For compiling a dynamically loaded module the same wrapper can  be used. The commands will be something like this:
 

-$ swig -lua example.i
+$ swig -lua example.i -o example_wrap.c
 $ gcc -I/usr/include/lua -c example_wrap.c -o example_wrap.o
 $ gcc -c example.c -o example.o
 $ gcc -shared -I/usr/include/lua -L/usr/lib/lua example_wrap.o example.o -o example.so