The BSDCan 2011 slides on BSDLUA are here: bsdlua.pdf and also here: .

The current (may be temporary) Mercurial (hg) repository for BSDLUA is available at .

You can make a local clone of the repository with:

hg clone

Please send patches via hg export!

Tutorial for embedders

Please read the following documentation:

The newest version of this script is committed in the BSDLUA hg repository in the bsdlua/tests/scripting directory.

An example program (note that this program and its Makefile require that the BSDLUA is installed, i.e. that the make install target was executed):

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>

#include <bsdlua.h>
#include <bsdlauxlib.h>

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, 1);
        printf("Hello from C: %s\n", arg);

        /* lua_pushstring(L, "blah blah blah"); */
        /* if the above line were uncommented, the function would return "1" */
        return 0;

        L = lua_open();

        luaL_dostring(L, "print(\"Hello from lua\")");

        lua_register(L, "greeting", greeting);
        luaL_dostring(L, "greeting(\"cromulent\")");

        /* Call BSDLUA */
        luaL_dostring(L, "print(\"My PID is: \" .. posix.getpid())");


all: luainc

        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

IvanVoras/BSDLUA (last edited 2011-05-29T22:50:49+0000 by IvanVoras)