lua.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. ** LUA - Linguagem para Usuarios de Aplicacao
  3. ** Grupo de Tecnologia em Computacao Grafica
  4. ** TeCGraf - PUC-Rio
  5. ** $Id: lua.h,v 1.5 1994/11/01 17:54:31 roberto Exp $
  6. */
  7. #ifndef lua_h
  8. #define lua_h
  9. /* Private Part */
  10. typedef enum
  11. {
  12. LUA_T_MARK,
  13. LUA_T_NIL,
  14. LUA_T_NUMBER,
  15. LUA_T_STRING,
  16. LUA_T_ARRAY,
  17. LUA_T_FUNCTION,
  18. LUA_T_CFUNCTION,
  19. LUA_T_USERDATA
  20. } Type;
  21. /* Public Part */
  22. typedef void (*lua_CFunction) (void);
  23. typedef struct Object *lua_Object;
  24. #define lua_register(n,f) (lua_pushcfunction(f), lua_storeglobal(n))
  25. void lua_errorfunction (void (*fn) (char *s));
  26. void lua_error (char *s);
  27. int lua_dofile (char *filename);
  28. int lua_dostring (char *string);
  29. int lua_callfunction (lua_Object function);
  30. lua_Object lua_getparam (int number);
  31. float lua_getnumber (lua_Object object);
  32. char *lua_getstring (lua_Object object);
  33. char *lua_copystring (lua_Object object);
  34. lua_CFunction lua_getcfunction (lua_Object object);
  35. void *lua_getuserdata (lua_Object object);
  36. void *lua_gettable (lua_Object object);
  37. lua_Object lua_getfield (lua_Object object, char *field);
  38. lua_Object lua_getindexed (lua_Object object, float index);
  39. lua_Object lua_getglobal (char *name);
  40. int lua_pushnil (void);
  41. int lua_pushnumber (float n);
  42. int lua_pushstring (char *s);
  43. int lua_pushcfunction (lua_CFunction fn);
  44. int lua_pushuserdata (void *u);
  45. int lua_pushtable (void *t);
  46. int lua_pushsubscript (void);
  47. int lua_pushobject (lua_Object object);
  48. int lua_storeglobal (char *name);
  49. int lua_storefield (lua_Object object, char *field);
  50. int lua_storeindexed (lua_Object object, float index);
  51. int lua_storesubscript (void);
  52. int lua_isnil (lua_Object object);
  53. int lua_isnumber (lua_Object object);
  54. int lua_isstring (lua_Object object);
  55. int lua_istable (lua_Object object);
  56. int lua_isfunction (lua_Object object);
  57. int lua_iscfunction (lua_Object object);
  58. int lua_isuserdata (lua_Object object);
  59. /* for lua 1.1 */
  60. #define lua_call(f) lua_callfunction(lua_getglobal(f))
  61. #endif