Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| ivanvoras:bsdlua [2011/05/14 03:17] – IvanVoras | ivanvoras:bsdlua [2011/05/29 22:50] (current) – IvanVoras | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| The BSDCan 2011 slides on BSDLUA are here: {{ivanvoras/ | The BSDCan 2011 slides on BSDLUA are here: {{ivanvoras/ | ||
| + | |||
| + | The current (may be temporary) Mercurial (hg) repository for BSDLUA is available at http:// | ||
| + | |||
| + | You can make a local clone of the repository with: | ||
| + | |||
| + | < | ||
| + | hg clone http:// | ||
| + | </ | ||
| + | |||
| + | Please send patches via '' | ||
| + | |||
| + | ===== Tutorial for embedders ===== | ||
| + | |||
| + | Please read the following documentation: | ||
| + | |||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | * http:// | ||
| + | |||
| + | The newest version of this script is committed in the BSDLUA hg repository in the '' | ||
| + | |||
| + | An example program (note that this program and its Makefile require that the BSDLUA is installed, i.e. that the '' | ||
| + | |||
| + | < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | lua_State *L; | ||
| + | |||
| + | static int | ||
| + | greeting(lua_State *L) | ||
| + | { | ||
| + | /* This function accepts one string argument and returns no values */ | ||
| + | int nargs = lua_gettop(L); | ||
| + | const char *arg; | ||
| + | |||
| + | assert(nargs == 1); | ||
| + | arg = lua_tostring(L, | ||
| + | printf(" | ||
| + | |||
| + | /* lua_pushstring(L, | ||
| + | /* if the above line were uncommented, | ||
| + | return 0; | ||
| + | } | ||
| + | |||
| + | int | ||
| + | main() | ||
| + | { | ||
| + | L = lua_open(); | ||
| + | luaL_openlibs(L); | ||
| + | |||
| + | luaL_dostring(L, | ||
| + | |||
| + | lua_register(L, | ||
| + | luaL_dostring(L, | ||
| + | |||
| + | /* Call BSDLUA */ | ||
| + | luaL_dostring(L, | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Makefile: | ||
| + | |||
| + | < | ||
| + | all: luainc | ||
| + | |||
| + | clean: | ||
| + | rm -f *.o *.core luainc | ||
| + | |||
| + | luainc: luainc.o | ||
| + | gcc -o luainc luainc.o -lbsdlua -lm -lcurses -lpanel | ||
| + | |||
| + | luainc.o: luainc.c | ||
| + | gcc -O2 -o luainc.o -c luainc.c | ||
| + | </ | ||