lua_lsup.c 479 B

123456789101112131415161718192021222324252627282930313233
  1. #include <lua.h>
  2. //#include <lualib.h>
  3. #include <lauxlib.h>
  4. #include <lsup_rdf.h>
  5. lua_State *L;
  6. static int l_init (lua_State *L)
  7. {
  8. LSUP_rc rc;
  9. if ((rc = LSUP_init ()) != LSUP_OK) {
  10. lua_pushnil (L);
  11. lua_pushstring (L, LSUP_strerror (rc));
  12. return 2;
  13. }
  14. return 0;
  15. }
  16. static const struct luaL_Reg lsup_lib [] = {
  17. {"init", l_init},
  18. {NULL, NULL}
  19. };
  20. int luaopen_lsup (lua_State *L)
  21. {
  22. luaL_newlib (L, lsup_lib);
  23. return 1;
  24. }