[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Getting started with the LUA API...
- From: Robert Anderberg <lua@...>
- Date: Tue, 09 Dec 2003 14:23:37 +0000
Hi,
-Is there a proper way to pass arguments/info/data from C to LUA,
check out the API section in the manual
you can either set a global variable in your Lua state, or call a Lua
function with some parameters.
-How could I really launch my script, I mean, there are two steps...
The first step would be to initialize my globals in LUA,
I dont really understand this bit. The Lua state is persistant, so just
call a Lua function to set up some variables, then call a 'main' function
each frame.
-A last step would be to return a behaviour... I don't see really
how to return something really clear to my C code, something
Again, check out the API section in the manual, you can return
a string, number, userdata (C pointer), or boolean value
(I probably missed one).
The best thing to do is read the book
(available at www.lua.org in .pdf and .ps formats)
make a simple test, get some code running and play about with it.
-My last question : as I always developped under Unix, and I've been
told to make it under Visual C++ 6, could you explain to me
Make a new static library project, put all the Lua files in a project
(except lua.c and luac.c) and compile. If you get into trouble,
someone where you work should be able to show you.
If you're working in c++ create a header called luaIncludes.h which does
this:
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}
Include that and your lib in any project you want to use Lua in and
you're set.
If there are experienced programmers there, ask them as many questions
as possible! that's why you're doing an internship.
best of the best, if you could provide me some really basic example
code...
sorry, don't have time ;) but writing the code is part of the learning
experience / fun.
I hope my English is ok, or all this will really be funny
It's better than my French, next time you post try to eliminate the linefeed
every two lines, it makes it very difficult to parse.
Remeber, just get something working! Less theory more typing! ;)
Rob