[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Dynamically create Lib?
- From: Matthias Beyer <mail@...>
- Date: Tue, 15 Oct 2013 19:50:45 +0200
Hi there!
Is it possible to dynamically register C functions in Lua?
Pseudocode:
add_function_to_lua(lua_State *L, char *libname, char *fname, int (*func)(lua_State *)) {
struct luaL_reg *reg = malloc(sizeof(*reg));
reg->name = fname;
reg->func = func;
luaL_register(L, libname, reg);
}
Or is there a better, maybe a simpler way to do such a thing.
Thanks in advance for your replies!
--
Mit freundlichen Grüßen,
Kind regards,
Matthias Beyer
Proudly sent with mutt.
Happily signed with gnupg.
Attachment:
pgpQLy5ij2vyw.pgp
Description: PGP signature