From b07745ab504290f6a0e2bf1333899d8f05f4f6a1 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Tue, 30 Jul 2013 14:49:52 +0100 Subject: [PATCH] Added Lua dll example --- examples/lua_dll.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/lua_dll.c diff --git a/examples/lua_dll.c b/examples/lua_dll.c new file mode 100644 index 00000000..e914c944 --- /dev/null +++ b/examples/lua_dll.c @@ -0,0 +1,19 @@ +#include + +#include "lua.h" +#include "lauxlib.h" + +static int smile(lua_State *L) { + (void) L; // Unused + printf("%s\n", ":-)"); + return 0; +} + +int LUA_API luaopen_lua_dll(lua_State *L) { + static const struct luaL_Reg api[] = { + {"smile", smile}, + {NULL, NULL}, + }; + luaL_openlib(L, "lua_dll", api, 0); + return 1; +}