[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Extending Lua
- From: Ervin Hegedüs <airween@...>
- Date: Thu, 27 Oct 2016 17:35:07 +0200
Hi Rena,
On Thu, Oct 27, 2016 at 11:27:23AM -0400, Rena wrote:
> On Thu, Oct 27, 2016 at 6:07 AM, Ervin Hegedüs <airween@gmail.com> wrote:
>
> >> this doesn't work - with or without assignment (example2 =
> >> require("example2") or simple require("example2")) I got:
> >>
> >
> > this works, I just missed change the type of return value of function
> > (luaopen_example2), and it stayed as "void", without return value.
> >
> > Now I think everything's clear.
> >
> >
> > Regards:
> >
> > a.
> >
>
> See http://www.lua.org/manual/5.3/manual.html#pdf-require for explanation:
>
> Your luaopen_example2() is a Lua function like any other and so is expected
> to push some values to the stack and return the number of values it pushed.
> You can set a global and not push anything (return 0), but in that case the
> require() call returns true. (However, the method you have now is
> preferred.)
thanks for the clarification,
a.