lua_dll.c 337 B

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