diff options
| -rw-r--r-- | lapi.c | 34 | ||||
| -rw-r--r-- | lua.h | 66 |
2 files changed, 50 insertions, 50 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 1.58 1999/11/23 13:58:02 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.59 1999/11/29 19:11:36 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -246,36 +246,36 @@ int lua_equal(lua_State *L, lua_Object o1, lua_Object o2) { | |||
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | 248 | ||
| 249 | double lua_getnumber (lua_State *L, lua_Object object) { | 249 | double lua_getnumber (lua_State *L, lua_Object obj) { |
| 250 | if (object == LUA_NOOBJECT) return 0.0; | 250 | if (obj == LUA_NOOBJECT) return 0.0; |
| 251 | if (tonumber(Address(L, object))) return 0.0; | 251 | if (tonumber(Address(L, obj))) return 0.0; |
| 252 | else return (nvalue(Address(L, object))); | 252 | else return (nvalue(Address(L, obj))); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | const char *lua_getstring (lua_State *L, lua_Object object) { | 255 | const char *lua_getstring (lua_State *L, lua_Object obj) { |
| 256 | luaC_checkGC(L); /* `tostring' may create a new string */ | 256 | luaC_checkGC(L); /* `tostring' may create a new string */ |
| 257 | if (object == LUA_NOOBJECT || tostring(L, Address(L, object))) | 257 | if (obj == LUA_NOOBJECT || tostring(L, Address(L, obj))) |
| 258 | return NULL; | 258 | return NULL; |
| 259 | else return (svalue(Address(L, object))); | 259 | else return (svalue(Address(L, obj))); |
| 260 | } | 260 | } |
| 261 | 261 | ||
| 262 | long lua_strlen (lua_State *L, lua_Object object) { | 262 | long lua_strlen (lua_State *L, lua_Object obj) { |
| 263 | luaC_checkGC(L); /* `tostring' may create a new string */ | 263 | luaC_checkGC(L); /* `tostring' may create a new string */ |
| 264 | if (object == LUA_NOOBJECT || tostring(L, Address(L, object))) | 264 | if (obj == LUA_NOOBJECT || tostring(L, Address(L, obj))) |
| 265 | return 0L; | 265 | return 0L; |
| 266 | else return (tsvalue(Address(L, object))->u.s.len); | 266 | else return (tsvalue(Address(L, obj))->u.s.len); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | void *lua_getuserdata (lua_State *L, lua_Object object) { | 269 | void *lua_getuserdata (lua_State *L, lua_Object obj) { |
| 270 | if (object == LUA_NOOBJECT || ttype(Address(L, object)) != LUA_T_USERDATA) | 270 | if (obj == LUA_NOOBJECT || ttype(Address(L, obj)) != LUA_T_USERDATA) |
| 271 | return NULL; | 271 | return NULL; |
| 272 | else return tsvalue(Address(L, object))->u.d.value; | 272 | else return tsvalue(Address(L, obj))->u.d.value; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | lua_CFunction lua_getcfunction (lua_State *L, lua_Object object) { | 275 | lua_CFunction lua_getcfunction (lua_State *L, lua_Object obj) { |
| 276 | if (!lua_iscfunction(L, object)) | 276 | if (!lua_iscfunction(L, obj)) |
| 277 | return NULL; | 277 | return NULL; |
| 278 | else return fvalue(luaA_protovalue(Address(L, object))); | 278 | else return fvalue(luaA_protovalue(Address(L, obj))); |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | 281 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lua.h,v 1.39 1999/11/25 18:44:02 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.40 1999/11/29 19:11:36 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 |
| @@ -42,7 +42,7 @@ void lua_settag (lua_State *L, int tag); /* In: object */ | |||
| 42 | void lua_error (lua_State *L, const char *s); | 42 | void lua_error (lua_State *L, const char *s); |
| 43 | int lua_dofile (lua_State *L, const char *filename); | 43 | int lua_dofile (lua_State *L, const char *filename); |
| 44 | /* Out: returns */ | 44 | /* Out: returns */ |
| 45 | int lua_dostring (lua_State *L, const char *string); | 45 | int lua_dostring (lua_State *L, const char *str); |
| 46 | /* Out: returns */ | 46 | /* Out: returns */ |
| 47 | int lua_dobuffer (lua_State *L, const char *buff, int size, | 47 | int lua_dobuffer (lua_State *L, const char *buff, int size, |
| 48 | const char *name); /* Out: returns */ | 48 | const char *name); /* Out: returns */ |
| @@ -56,23 +56,23 @@ lua_Object lua_lua2C (lua_State *L, int number); | |||
| 56 | #define lua_getparam lua_lua2C | 56 | #define lua_getparam lua_lua2C |
| 57 | #define lua_getresult lua_lua2C | 57 | #define lua_getresult lua_lua2C |
| 58 | 58 | ||
| 59 | const char *lua_type (lua_State *L, lua_Object object); | 59 | const char *lua_type (lua_State *L, lua_Object obj); |
| 60 | 60 | ||
| 61 | int lua_isnil (lua_State *L, lua_Object object); | 61 | int lua_isnil (lua_State *L, lua_Object obj); |
| 62 | int lua_istable (lua_State *L, lua_Object object); | 62 | int lua_istable (lua_State *L, lua_Object obj); |
| 63 | int lua_isuserdata (lua_State *L, lua_Object object); | 63 | int lua_isuserdata (lua_State *L, lua_Object obj); |
| 64 | int lua_iscfunction (lua_State *L, lua_Object object); | 64 | int lua_iscfunction (lua_State *L, lua_Object obj); |
| 65 | int lua_isnumber (lua_State *L, lua_Object object); | 65 | int lua_isnumber (lua_State *L, lua_Object obj); |
| 66 | int lua_isstring (lua_State *L, lua_Object object); | 66 | int lua_isstring (lua_State *L, lua_Object obj); |
| 67 | int lua_isfunction (lua_State *L, lua_Object object); | 67 | int lua_isfunction (lua_State *L, lua_Object obj); |
| 68 | 68 | ||
| 69 | int lua_equal (lua_State *L, lua_Object o1, lua_Object o2); | 69 | int lua_equal (lua_State *L, lua_Object o1, lua_Object o2); |
| 70 | 70 | ||
| 71 | double lua_getnumber (lua_State *L, lua_Object object); | 71 | double lua_getnumber (lua_State *L, lua_Object obj); |
| 72 | const char *lua_getstring (lua_State *L, lua_Object object); | 72 | const char *lua_getstring (lua_State *L, lua_Object obj); |
| 73 | long lua_strlen (lua_State *L, lua_Object object); | 73 | long lua_strlen (lua_State *L, lua_Object obj); |
| 74 | lua_CFunction lua_getcfunction (lua_State *L, lua_Object object); | 74 | lua_CFunction lua_getcfunction (lua_State *L, lua_Object obj); |
| 75 | void *lua_getuserdata (lua_State *L, lua_Object object); | 75 | void *lua_getuserdata (lua_State *L, lua_Object obj); |
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | void lua_pushnil (lua_State *L); | 78 | void lua_pushnil (lua_State *L); |
| @@ -81,7 +81,7 @@ void lua_pushlstring (lua_State *L, const char *s, long len); | |||
| 81 | void lua_pushstring (lua_State *L, const char *s); | 81 | void lua_pushstring (lua_State *L, const char *s); |
| 82 | void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); | 82 | void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n); |
| 83 | void lua_pushusertag (lua_State *L, void *u, int tag); | 83 | void lua_pushusertag (lua_State *L, void *u, int tag); |
| 84 | void lua_pushobject (lua_State *L, lua_Object object); | 84 | void lua_pushobject (lua_State *L, lua_Object obj); |
| 85 | 85 | ||
| 86 | lua_Object lua_pop (lua_State *L); | 86 | lua_Object lua_pop (lua_State *L); |
| 87 | 87 | ||
| @@ -95,7 +95,7 @@ void lua_rawsettable (lua_State *L); /* In: table, index, value */ | |||
| 95 | lua_Object lua_gettable (lua_State *L); /* In: table, index */ | 95 | lua_Object lua_gettable (lua_State *L); /* In: table, index */ |
| 96 | lua_Object lua_rawgettable (lua_State *L); /* In: table, index */ | 96 | lua_Object lua_rawgettable (lua_State *L); /* In: table, index */ |
| 97 | 97 | ||
| 98 | int lua_tag (lua_State *L, lua_Object object); | 98 | int lua_tag (lua_State *L, lua_Object obj); |
| 99 | 99 | ||
| 100 | const char *lua_nextvar (lua_State *L, const char *varname); /* Out: value */ | 100 | const char *lua_nextvar (lua_State *L, const char *varname); /* Out: value */ |
| 101 | int lua_next (lua_State *L, lua_Object o, int i); | 101 | int lua_next (lua_State *L, lua_Object o, int i); |
| @@ -166,32 +166,32 @@ extern lua_State *lua_state; | |||
| 166 | #define lua_settag(tag) (lua_settag)(lua_state, tag) | 166 | #define lua_settag(tag) (lua_settag)(lua_state, tag) |
| 167 | #define lua_error(s) (lua_error)(lua_state, s) | 167 | #define lua_error(s) (lua_error)(lua_state, s) |
| 168 | #define lua_dofile(filename) (lua_dofile)(lua_state, filename) | 168 | #define lua_dofile(filename) (lua_dofile)(lua_state, filename) |
| 169 | #define lua_dostring(string) (lua_dostring)(lua_state, string) | 169 | #define lua_dostring(str) (lua_dostring)(lua_state, str) |
| 170 | #define lua_callfunction(f) (lua_callfunction)(lua_state, f) | 170 | #define lua_callfunction(f) (lua_callfunction)(lua_state, f) |
| 171 | #define lua_beginblock() (lua_beginblock)(lua_state) | 171 | #define lua_beginblock() (lua_beginblock)(lua_state) |
| 172 | #define lua_endblock() (lua_endblock)(lua_state) | 172 | #define lua_endblock() (lua_endblock)(lua_state) |
| 173 | #define lua_lua2C(number) (lua_lua2C)(lua_state, number) | 173 | #define lua_lua2C(number) (lua_lua2C)(lua_state, number) |
| 174 | #define lua_type(object) (lua_type)(lua_state, object) | 174 | #define lua_type(obj) (lua_type)(lua_state, obj) |
| 175 | #define lua_isnil(object) (lua_isnil)(lua_state, object) | 175 | #define lua_isnil(obj) (lua_isnil)(lua_state, obj) |
| 176 | #define lua_istable(object) (lua_istable)(lua_state, object) | 176 | #define lua_istable(obj) (lua_istable)(lua_state, obj) |
| 177 | #define lua_isuserdata(object) (lua_isuserdata)(lua_state, object) | 177 | #define lua_isuserdata(obj) (lua_isuserdata)(lua_state, obj) |
| 178 | #define lua_iscfunction(object) (lua_iscfunction)(lua_state, object) | 178 | #define lua_iscfunction(obj) (lua_iscfunction)(lua_state, obj) |
| 179 | #define lua_isnumber(object) (lua_isnumber)(lua_state, object) | 179 | #define lua_isnumber(obj) (lua_isnumber)(lua_state, obj) |
| 180 | #define lua_isstring(object) (lua_isstring)(lua_state, object) | 180 | #define lua_isstring(obj) (lua_isstring)(lua_state, obj) |
| 181 | #define lua_isfunction(object) (lua_isfunction)(lua_state, object) | 181 | #define lua_isfunction(obj) (lua_isfunction)(lua_state, obj) |
| 182 | #define lua_equal(o1,o2) (lua_equal)(lua_state, o1,o2) | 182 | #define lua_equal(o1,o2) (lua_equal)(lua_state, o1,o2) |
| 183 | #define lua_getnumber(object) (lua_getnumber)(lua_state, object) | 183 | #define lua_getnumber(obj) (lua_getnumber)(lua_state, obj) |
| 184 | #define lua_getstring(object) (lua_getstring)(lua_state, object) | 184 | #define lua_getstring(obj) (lua_getstring)(lua_state, obj) |
| 185 | #define lua_strlen(object) (lua_strlen)(lua_state, object) | 185 | #define lua_strlen(obj) (lua_strlen)(lua_state, obj) |
| 186 | #define lua_getcfunction(object) (lua_getcfunction)(lua_state, object) | 186 | #define lua_getcfunction(obj) (lua_getcfunction)(lua_state, obj) |
| 187 | #define lua_getuserdata(object) (lua_getuserdata)(lua_state, object) | 187 | #define lua_getuserdata(obj) (lua_getuserdata)(lua_state, obj) |
| 188 | #define lua_pushnil() (lua_pushnil)(lua_state) | 188 | #define lua_pushnil() (lua_pushnil)(lua_state) |
| 189 | #define lua_pushnumber(n) (lua_pushnumber)(lua_state, n) | 189 | #define lua_pushnumber(n) (lua_pushnumber)(lua_state, n) |
| 190 | #define lua_pushlstring(s,len) (lua_pushlstring)(lua_state, s,len) | 190 | #define lua_pushlstring(s,len) (lua_pushlstring)(lua_state, s,len) |
| 191 | #define lua_pushstring(s) (lua_pushstring)(lua_state, s) | 191 | #define lua_pushstring(s) (lua_pushstring)(lua_state, s) |
| 192 | #define lua_pushcclosure(fn,n) (lua_pushcclosure)(lua_state, fn,n) | 192 | #define lua_pushcclosure(fn,n) (lua_pushcclosure)(lua_state, fn,n) |
| 193 | #define lua_pushusertag(u,tag) (lua_pushusertag)(lua_state, u,tag) | 193 | #define lua_pushusertag(u,tag) (lua_pushusertag)(lua_state, u,tag) |
| 194 | #define lua_pushobject(object) (lua_pushobject)(lua_state, object) | 194 | #define lua_pushobject(obj) (lua_pushobject)(lua_state, obj) |
| 195 | #define lua_pop() (lua_pop)(lua_state) | 195 | #define lua_pop() (lua_pop)(lua_state) |
| 196 | #define lua_getglobal(name) (lua_getglobal)(lua_state, name) | 196 | #define lua_getglobal(name) (lua_getglobal)(lua_state, name) |
| 197 | #define lua_rawgetglobal(name) (lua_rawgetglobal)(lua_state, name) | 197 | #define lua_rawgetglobal(name) (lua_rawgetglobal)(lua_state, name) |
| @@ -201,7 +201,7 @@ extern lua_State *lua_state; | |||
| 201 | #define lua_rawsettable() (lua_rawsettable)(lua_state) | 201 | #define lua_rawsettable() (lua_rawsettable)(lua_state) |
| 202 | #define lua_gettable() (lua_gettable)(lua_state) | 202 | #define lua_gettable() (lua_gettable)(lua_state) |
| 203 | #define lua_rawgettable() (lua_rawgettable)(lua_state) | 203 | #define lua_rawgettable() (lua_rawgettable)(lua_state) |
| 204 | #define lua_tag(object) (lua_tag)(lua_state, object) | 204 | #define lua_tag(obj) (lua_tag)(lua_state, obj) |
| 205 | #define lua_nextvar(varname) (lua_nextvar)(lua_state, varname) | 205 | #define lua_nextvar(varname) (lua_nextvar)(lua_state, varname) |
| 206 | #define lua_next(o,i) (lua_next)(lua_state, o,i) | 206 | #define lua_next(o,i) (lua_next)(lua_state, o,i) |
| 207 | #define lua_ref(lock) (lua_ref)(lua_state, lock) | 207 | #define lua_ref(lock) (lua_ref)(lua_state, lock) |
