lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


If your using the latest stable release you should be able to create
a new dynamic or static lib project and simply drag all the Lua .h
and .c files into it. I've done this numerous times - it should
compile cleanly.

Download the lib here:

http://www.lua.org/download.html

Gunzip, then untar it. Then in MSVC create a new project, either
a dll or a static lib. When you create it specify the lua dir as the
base for the project.  I usually name the project 'lualib' or similar,
so I end up with the following:

lua/lualib/msvc project files

(If you create a DLL, you'll have to change the LUA_API define in lua.h
from 'extern' to '__declspec(dllexport)' )

Then right click the project in MSVC after it's created and select
"add files to project". Go into the lua/src dir and add all the .c's and
.h's. Also add the aux lib src files in lua/src/lib. These give you
additional functionality like debugging support, basic fileio, math
functions, strings and few other odds and ends.

Next create an include path to the project so MSVC knows where
lua.h is. (Project->Settings->C/C++ Tab->Category:Preprocessor,
in the the "Additional Include Directories" text entry put: "../include"

Then compile it. Like I said, it should compile clean... I just tested this
with the latest and here's the compile:

--------------------Configuration: lualib - Win32 Debug--------------------
Compiling...
lapi.c
lcode.c
ldebug.c
ldo.c
lfunc.c
lgc.c
llex.c
lmem.c
lobject.c
lparser.c
lstate.c
lstring.c
ltable.c
ltests.c
ltm.c
lundump.c
lvm.c
lzio.c
lstrlib.c
lauxlib.c
lbaselib.c
ldblib.c
liolib.c
lmathlib.c
Creating library...

lualib.lib - 0 error(s), 0 warning(s)
----------------------------------------------------------------------------
------

Now you either have a DLL or a static lib you can link to.
All you have to do is link this into your game, initialize
the lua vm and it's libs and you can start using Lua.

Since I just did all this to make sure it would work.. I zipped
up the result (including an example console app) and put it
here.

http://www.mathies.com/temp/

If it doesn't already exist, maybe somebody should put this
project up on the Wiki?

Hope this helps...

Regards,
Jim









--
Your born, you die. What happens in between is up to you.
----- Original Message -----
From: "Joms Araneta" <jomsaraneta@hotmail.com>
To: "Multiple recipients of list" <lua-l@tecgraf.puc-rio.br>
Sent: Sunday, April 14, 2002 5:27 AM
Subject: Installing Lua on MSVC++6


> Hi everyone!
>
>     I'm really confused, how do you install Lua and toLua on a Win32
system?
> The lua downloads site only says to copy all *.h *.c and create a project
> file and compile them. But can anyone give me a step-by-step description
of
> how to do it? And how would you bind lua to a game engine?
>
> Thanks,
>         Joms
>
>
>