[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Fw: [LuaCheia-list] lib_open in nested table
- From: "Martin Spernau" <martin@...>
- Date: Wed, 5 Mar 2003 22:00:50 +0100
Hello List,
maybe someone has done something like this before and there is am easy and
tried way to do it...
I need to register some C functions from a lib into a table. But this table
is not in the global table, but a sub-table.
so I need to register function foo() as lib.myname.foo()
please see below for details.
Thanks, Martin
From: "Martin Spernau" <martin@traumwind.de>
> Ok, I'm stuck.
>
> We want to have e.g. pcre functions in lib.pcre.match()
> Now I know how to write a register function to put my functions into a
> global table:
>
> ###
> static const luaL_reg mylib[] = {
> {"func1", func1},
> {"func2", func2},
> {NULL, NULL}
> };
>
>
> /*
> ** Open my library
> */
> LUALIB_API int lua_mylibopen (lua_State *L) {
> luaL_openlib(L, "my", mylib, 0);
> return 0;
> }
> ###
>
> And how do I put my stuff into one level deeper?
> Some quick pointer would be welcome,
>
> -Martin