lua-users home
lua-l archive

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


On Wed, Sep 06, 2006 at 09:34:11AM -0300, Fabian Peña wrote:
> And for calling to a globals functions that being loaded from your
> scripts use some like this
> 
> by example in lua have
> 
> function OnInitialUpdate(str)
>     print("Hello",str);
>    
> end
> 
> Call it from C
>  
>     lua_getglobal(L,"OnInitialUpdate");

If you have a number of scripts, all defining OnInitialUpdate(), I think
you have to set the "global environment" (getfenv/setfenv) before
loading and calling the script/block, so that the functions don't all
get assigned to the same global variable.

Just a hint, maybe somebody who has done this can be more specific.

Cheers,
Sam