lua-users home
lua-l archive

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


Hello Steve

Thanks for the answer.. I added this and now I can't get it to compile.. 

gcc test.c -I/usr/local/include -L/usr/local/lib -llua -o test

is there any other header I need other then lua.h. Here is what I have so 
far..

#include <lua.h>

int main() {
        int status;
        lua_State *L;
        L = lua_open(1000);
        lua_baselibopen(L);
        lua_iolibopen(L);
        lua_strlibopen(L);
        lua_mathlibopen(L);
        status = lua_dofile(L,"test.lua");
        printf("Status: %i",status);
        lua_close(L);
}

Oh, ya I am running lua 4.0.1

Thanks again
Ben


Steve Dekorte wrote:

> 
> On Tuesday, August 20, 2002, at 08:56  AM, ben wrote:
>> int main() {
>>         int status;
>>         lua_State *L;
>>         L = lua_open(1000);
>>         status = lua_dofile(L,"test.lua");
>>         printf("Status: %i",status);
>>         lua_close(L);
>> }
> 
> Hi Ben,
> 
> You need to open Lua's standard libraries. In 4.1, you'd call the
> following:
> 
>    lua_baselibopen(L);
>    lua_iolibopen(L);
>    lua_strlibopen(L);
>    lua_mathlibopen(L);
> 
> Cheers,
> Steve