#include <stdio.h>
#include <llua.h>
typedef llua_t *llua;
int l_myfun(lua_State *L) {
int ival;
const char *sval;
lua_pushnil(L);
ival = lua_tointeger(L,-1);
printf("ival %d\n",ival);
llua r = llua_new(L,-1);
void *val = llua_call_or_die(r,L_NONE,L_VAL);
return 0;
}
int main (int argc, char **argv)
{
lua_State *L = luaL_newstate();
luaL_openlibs(L);
llua myfun = llua_cfunction(L,l_myfun);
err_t res = llua_callf(myfun,L_NONE,L_VAL);
if (res) {
fprintf(stderr,"failed %s\n",res);
}
lua_close(L);
return 0;
}