diff options
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 127 |
1 files changed, 66 insertions, 61 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.73 2000/10/05 12:14:08 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.74 2000/10/09 15:46:43 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
5 | ** e-mail: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
@@ -16,6 +16,11 @@ | |||
16 | #include <stddef.h> | 16 | #include <stddef.h> |
17 | 17 | ||
18 | 18 | ||
19 | #ifndef LUA_API | ||
20 | #define LUA_API extern | ||
21 | #endif | ||
22 | |||
23 | |||
19 | #define LUA_VERSION "Lua 4.0 (beta)" | 24 | #define LUA_VERSION "Lua 4.0 (beta)" |
20 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" | 25 | #define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio" |
21 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" | 26 | #define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo" |
@@ -65,113 +70,113 @@ typedef int (*lua_CFunction) (lua_State *L); | |||
65 | /* | 70 | /* |
66 | ** state manipulation | 71 | ** state manipulation |
67 | */ | 72 | */ |
68 | lua_State *lua_open (int stacksize); | 73 | LUA_API lua_State *lua_open (int stacksize); |
69 | void lua_close (lua_State *L); | 74 | LUA_API void lua_close (lua_State *L); |
70 | 75 | ||
71 | 76 | ||
72 | /* | 77 | /* |
73 | ** basic stack manipulation | 78 | ** basic stack manipulation |
74 | */ | 79 | */ |
75 | int lua_gettop (lua_State *L); | 80 | LUA_API int lua_gettop (lua_State *L); |
76 | void lua_settop (lua_State *L, int index); | 81 | LUA_API void lua_settop (lua_State *L, int index); |
77 | void lua_pushvalue (lua_State *L, int index); | 82 | LUA_API void lua_pushvalue (lua_State *L, int index); |
78 | void lua_remove (lua_State *L, int index); | 83 | LUA_API void lua_remove (lua_State *L, int index); |
79 | void lua_insert (lua_State *L, int index); | 84 | LUA_API void lua_insert (lua_State *L, int index); |
80 | int lua_stackspace (lua_State *L); | 85 | LUA_API int lua_stackspace (lua_State *L); |
81 | 86 | ||
82 | 87 | ||
83 | /* | 88 | /* |
84 | ** access functions (stack -> C) | 89 | ** access functions (stack -> C) |
85 | */ | 90 | */ |
86 | 91 | ||
87 | int lua_type (lua_State *L, int index); | 92 | LUA_API int lua_type (lua_State *L, int index); |
88 | const char *lua_typename (lua_State *L, int t); | 93 | LUA_API const char *lua_typename (lua_State *L, int t); |
89 | int lua_isnumber (lua_State *L, int index); | 94 | LUA_API int lua_isnumber (lua_State *L, int index); |
90 | int lua_isstring (lua_State *L, int index); | 95 | LUA_API int lua_isstring (lua_State *L, int index); |
91 | int lua_iscfunction (lua_State *L, int index); | 96 | LUA_API int lua_iscfunction (lua_State *L, int index); |
92 | int lua_tag (lua_State *L, int index); | 97 | LUA_API int lua_tag (lua_State *L, int index); |
93 | 98 | ||
94 | int lua_equal (lua_State *L, int index1, int index2); | 99 | LUA_API int lua_equal (lua_State *L, int index1, int index2); |
95 | int lua_lessthan (lua_State *L, int index1, int index2); | 100 | LUA_API int lua_lessthan (lua_State *L, int index1, int index2); |
96 | 101 | ||
97 | double lua_tonumber (lua_State *L, int index); | 102 | LUA_API double lua_tonumber (lua_State *L, int index); |
98 | const char *lua_tostring (lua_State *L, int index); | 103 | LUA_API const char *lua_tostring (lua_State *L, int index); |
99 | size_t lua_strlen (lua_State *L, int index); | 104 | LUA_API size_t lua_strlen (lua_State *L, int index); |
100 | lua_CFunction lua_tocfunction (lua_State *L, int index); | 105 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int index); |
101 | void *lua_touserdata (lua_State *L, int index); | 106 | LUA_API void *lua_touserdata (lua_State *L, int index); |
102 | const void *lua_topointer (lua_State *L, int index); | 107 | LUA_API const void *lua_topointer (lua_State *L, int index); |
103 | 108 | ||
104 | 109 | ||
105 | /* | 110 | /* |
106 | ** push functions (C -> stack) | 111 | ** push functions (C -> stack) |
107 | */ | 112 | */ |
108 | void lua_pushnil (lua_State *L); | 113 | LUA_API void lua_pushnil (lua_State *L); |
109 | void lua_pushnumber (lua_State *L, double n); | 114 | LUA_API void lua_pushnumber (lua_State *L, double n); |
110 | void lua_pushlstring (lua_State *L, const char *s, size_t len); | 115 | LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len); |
111 | void lua_pushstring (lua_State *L, const char *s); | 116 | LUA_API void lua_pushstring (lua_State *L, const char *s); |
112 | void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); | 117 | LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); |
113 | void lua_pushusertag (lua_State *L, void *u, int tag); | 118 | LUA_API void lua_pushusertag (lua_State *L, void *u, int tag); |
114 | 119 | ||
115 | 120 | ||
116 | /* | 121 | /* |
117 | ** get functions (Lua -> stack) | 122 | ** get functions (Lua -> stack) |
118 | */ | 123 | */ |
119 | void lua_getglobal (lua_State *L, const char *name); | 124 | LUA_API void lua_getglobal (lua_State *L, const char *name); |
120 | void lua_gettable (lua_State *L, int index); | 125 | LUA_API void lua_gettable (lua_State *L, int index); |
121 | void lua_rawget (lua_State *L, int index); | 126 | LUA_API void lua_rawget (lua_State *L, int index); |
122 | void lua_rawgeti (lua_State *L, int index, int n); | 127 | LUA_API void lua_rawgeti (lua_State *L, int index, int n); |
123 | void lua_getglobals (lua_State *L); | 128 | LUA_API void lua_getglobals (lua_State *L); |
124 | void lua_gettagmethod (lua_State *L, int tag, const char *event); | 129 | LUA_API void lua_gettagmethod (lua_State *L, int tag, const char *event); |
125 | 130 | ||
126 | int lua_getref (lua_State *L, int ref); | 131 | LUA_API int lua_getref (lua_State *L, int ref); |
127 | 132 | ||
128 | void lua_newtable (lua_State *L); | 133 | LUA_API void lua_newtable (lua_State *L); |
129 | 134 | ||
130 | 135 | ||
131 | /* | 136 | /* |
132 | ** set functions (stack -> Lua) | 137 | ** set functions (stack -> Lua) |
133 | */ | 138 | */ |
134 | void lua_setglobal (lua_State *L, const char *name); | 139 | LUA_API void lua_setglobal (lua_State *L, const char *name); |
135 | void lua_settable (lua_State *L, int index); | 140 | LUA_API void lua_settable (lua_State *L, int index); |
136 | void lua_rawset (lua_State *L, int index); | 141 | LUA_API void lua_rawset (lua_State *L, int index); |
137 | void lua_rawseti (lua_State *L, int index, int n); | 142 | LUA_API void lua_rawseti (lua_State *L, int index, int n); |
138 | void lua_setglobals (lua_State *L); | 143 | LUA_API void lua_setglobals (lua_State *L); |
139 | void lua_settagmethod (lua_State *L, int tag, const char *event); | 144 | LUA_API void lua_settagmethod (lua_State *L, int tag, const char *event); |
140 | int lua_ref (lua_State *L, int lock); | 145 | LUA_API int lua_ref (lua_State *L, int lock); |
141 | 146 | ||
142 | 147 | ||
143 | /* | 148 | /* |
144 | ** "do" functions (run Lua code) | 149 | ** "do" functions (run Lua code) |
145 | */ | 150 | */ |
146 | int lua_call (lua_State *L, int nargs, int nresults); | 151 | LUA_API int lua_call (lua_State *L, int nargs, int nresults); |
147 | void lua_rawcall (lua_State *L, int nargs, int nresults); | 152 | LUA_API void lua_rawcall (lua_State *L, int nargs, int nresults); |
148 | int lua_dofile (lua_State *L, const char *filename); | 153 | LUA_API int lua_dofile (lua_State *L, const char *filename); |
149 | int lua_dostring (lua_State *L, const char *str); | 154 | LUA_API int lua_dostring (lua_State *L, const char *str); |
150 | int lua_dobuffer (lua_State *L, const char *buff, size_t size, | 155 | LUA_API int lua_dobuffer (lua_State *L, const char *buff, size_t size, |
151 | const char *name); | 156 | const char *name); |
152 | 157 | ||
153 | /* | 158 | /* |
154 | ** Garbage-collection functions | 159 | ** Garbage-collection functions |
155 | */ | 160 | */ |
156 | int lua_getgcthreshold (lua_State *L); | 161 | LUA_API int lua_getgcthreshold (lua_State *L); |
157 | int lua_getgccount (lua_State *L); | 162 | LUA_API int lua_getgccount (lua_State *L); |
158 | void lua_setgcthreshold (lua_State *L, int newthreshold); | 163 | LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold); |
159 | 164 | ||
160 | /* | 165 | /* |
161 | ** miscellaneous functions | 166 | ** miscellaneous functions |
162 | */ | 167 | */ |
163 | int lua_newtag (lua_State *L); | 168 | LUA_API int lua_newtag (lua_State *L); |
164 | int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); | 169 | LUA_API int lua_copytagmethods (lua_State *L, int tagto, int tagfrom); |
165 | void lua_settag (lua_State *L, int tag); | 170 | LUA_API void lua_settag (lua_State *L, int tag); |
166 | 171 | ||
167 | void lua_error (lua_State *L, const char *s); | 172 | LUA_API void lua_error (lua_State *L, const char *s); |
168 | 173 | ||
169 | void lua_unref (lua_State *L, int ref); | 174 | LUA_API void lua_unref (lua_State *L, int ref); |
170 | 175 | ||
171 | int lua_next (lua_State *L, int index); | 176 | LUA_API int lua_next (lua_State *L, int index); |
172 | int lua_getn (lua_State *L, int index); | 177 | LUA_API int lua_getn (lua_State *L, int index); |
173 | 178 | ||
174 | void lua_concat (lua_State *L, int n); | 179 | LUA_API void lua_concat (lua_State *L, int n); |
175 | 180 | ||
176 | 181 | ||
177 | /* | 182 | /* |