lua.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. ** LUA - Linguagem para Usuarios de Aplicacao
  3. ** Grupo de Tecnologia em Computacao Grafica
  4. ** TeCGraf - PUC-Rio
  5. ** $Id: lua.h,v 3.33 1997/02/11 11:40:01 roberto Exp roberto $
  6. */
  7. #ifndef lua_h
  8. #define lua_h
  9. #define LUA_VERSION "Lua 2.?"
  10. #define LUA_COPYRIGHT "Copyright (C) 1994-1996 TeCGraf"
  11. #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
  12. #define LUA_NOOBJECT 0
  13. typedef void (*lua_CFunction) (void);
  14. typedef unsigned int lua_Object;
  15. lua_Object lua_setfallback (char *name, lua_CFunction fallback);
  16. void lua_error (char *s);
  17. int lua_dofile (char *filename);
  18. int lua_dostring (char *string);
  19. int lua_callfunction (lua_Object function);
  20. int lua_call (char *funcname);
  21. void lua_beginblock (void);
  22. void lua_endblock (void);
  23. lua_Object lua_getparam (int number);
  24. #define lua_getresult(_) lua_getparam(_)
  25. int lua_isnil (lua_Object object);
  26. int lua_istable (lua_Object object);
  27. int lua_isuserdata (lua_Object object);
  28. int lua_iscfunction (lua_Object object);
  29. int lua_isnumber (lua_Object object);
  30. int lua_isstring (lua_Object object);
  31. int lua_isfunction (lua_Object object);
  32. float lua_getnumber (lua_Object object);
  33. char *lua_getstring (lua_Object object);
  34. lua_CFunction lua_getcfunction (lua_Object object);
  35. void *lua_getbinarydata (lua_Object object);
  36. int lua_getbindatasize (lua_Object object);
  37. void lua_pushnil (void);
  38. void lua_pushnumber (float n);
  39. void lua_pushstring (char *s);
  40. void lua_pushcfunction (lua_CFunction fn);
  41. void lua_pushbinarydata (void *buff, int size, int tag);
  42. void lua_pushusertag (void *u, int tag);
  43. void lua_pushobject (lua_Object object);
  44. lua_Object lua_getglobal (char *name);
  45. void lua_storeglobal (char *name);
  46. void lua_storesubscript (void);
  47. lua_Object lua_getsubscript (void);
  48. int lua_type (lua_Object object);
  49. int lua_ref (int lock);
  50. lua_Object lua_getref (int ref);
  51. void lua_pushref (int ref);
  52. void lua_unref (int ref);
  53. lua_Object lua_createtable (void);
  54. /* some useful macros */
  55. #define lua_refobject(o,l) (lua_pushobject(o), lua_ref(l))
  56. #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n))
  57. #define lua_pushuserdata(u) lua_pushusertag(u, 0)
  58. /* for compatibility with old versions. Avoid using these macros */
  59. #define lua_getuserdata(o) (*(void **)lua_getbinarydata(o))
  60. #define lua_lockobject(o) lua_refobject(o,1)
  61. #define lua_lock() lua_ref(1)
  62. #define lua_getlocked lua_getref
  63. #define lua_pushlocked lua_pushref
  64. #define lua_unlock lua_unref
  65. #define lua_pushliteral(o) lua_pushstring(o)
  66. #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript())
  67. #define lua_getfield(o,f) (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript())
  68. #define lua_copystring(o) (strdup(lua_getstring(o)))
  69. #endif