lua_dll.c 359 B

123456789101112131415161718192021
  1. #include <stdio.h>
  2. #include "lua.h"
  3. #include "lauxlib.h"
  4. static int smile(lua_State *L)
  5. {
  6. (void) L; // Unused
  7. printf("%s\n", ":-)");
  8. return 0;
  9. }
  10. int LUA_API luaopen_lua_dll(lua_State *L)
  11. {
  12. static const struct luaL_Reg api[] = {
  13. {"smile", smile},
  14. {NULL, NULL},
  15. };
  16. luaL_openlib(L, "lua_dll", api, 0);
  17. return 1;
  18. }