lua-users home
lua-l archive

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


Thank You Javier, Your tips helped me overcome my error.

Regards
Santosh
Message: 2
Date: Wed, 10 Dec 2014 08:57:51 -0500
From: Javier Guerra Giraldez <javier@guerrag.com>
Subject: Re: Lua C program return value...
To: Lua mailing list <lua-l@lists.lua.org>
Message-ID:
        <CAFkDaoQpKgpvaftL4u2sHkoKdRf9pFZbFvtsD0FOOdnTPw2yXg@mail.gmail.com" style="font-size:13px">CAFkDaoQpKgpvaftL4u2sHkoKdRf9pFZbFvtsD0FOOdnTPw2yXg@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Wed, Dec 10, 2014 at 8:52 AM, Santosh Kadam <sanmanik@gmail.com> wrote:
> What I have observed is that if I don't call openlibs - I don't get the
> value returned to the LUA function. From the debug logs (lua asserts)  - I
> can see that an error is printed like this "An attempt to print (nil)
> value."


is that the exact error message?  i think it should be "attempt to
call global 'print' (a nil value)", which means that 'print' isn't
defined, as should be expected if you haven't loaded the standard
library by skipping luaL_openlibs(L)

in short: no, it's not mandatory to call luaL_openlibs; but if you
don't then you don't get any default function, like print()

--
Javier