lua-users home
lua-l archive

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

It was thus said that the Great Luiz Henrique de Figueiredo once stated:
> Try the code below and then compare to your own.

  32 bit Linux, Lua 5.1.4 (with all the patches [1]) and the following C

#include <stdio.h>
#include <lua.h>

static int construct(lua_State *L)
  int stack_size;
  stack_size = lua_gettop(L);
  printf("construct %d items in stack\n",stack_size);
  return 1;

int luaopen_construct(lua_State *L)
  return 0;

[spc]lucy:~/source/lua/C>gcc -shared -fPIC -o construct.c 
Lua 5.1.4  Copyright (C) 1994-2008, PUC-Rio
> require "construct"
> print(construct(10,20,30,40))
construct 4 items in stack

  -spc (In other words, it worked for me)