diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-06 11:08:08 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-04-06 11:08:08 -0300 |
commit | 3a9516ffc8de0d33051f83dc786dba615d6bac49 (patch) | |
tree | 9608796ca5abb4a724d70d99cb34dd818eb95662 /inout.c | |
parent | 42fa305649199712aad1c96beadb944b01277e3f (diff) | |
download | lua-3a9516ffc8de0d33051f83dc786dba615d6bac49.tar.gz lua-3a9516ffc8de0d33051f83dc786dba615d6bac49.tar.bz2 lua-3a9516ffc8de0d33051f83dc786dba615d6bac49.zip |
luaL check functions do not need the function name (it can be
accessed via luadebug interface).
Diffstat (limited to 'inout.c')
-rw-r--r-- | inout.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -5,7 +5,7 @@ | |||
5 | ** Also provides some predefined lua functions. | 5 | ** Also provides some predefined lua functions. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | char *rcs_inout="$Id: inout.c,v 2.54 1997/04/02 23:04:12 roberto Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.55 1997/04/04 22:24:51 roberto Exp roberto $"; |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <string.h> | 11 | #include <string.h> |
@@ -122,7 +122,7 @@ static int passresults (void) | |||
122 | */ | 122 | */ |
123 | static void lua_internaldostring (void) | 123 | static void lua_internaldostring (void) |
124 | { | 124 | { |
125 | if (lua_dostring(luaL_check_string(1, "dostring")) == 0) | 125 | if (lua_dostring(luaL_check_string(1)) == 0) |
126 | if (passresults() == 0) | 126 | if (passresults() == 0) |
127 | lua_pushuserdata(NULL); /* at least one result to signal no errors */ | 127 | lua_pushuserdata(NULL); /* at least one result to signal no errors */ |
128 | } | 128 | } |
@@ -132,7 +132,7 @@ static void lua_internaldostring (void) | |||
132 | */ | 132 | */ |
133 | static void lua_internaldofile (void) | 133 | static void lua_internaldofile (void) |
134 | { | 134 | { |
135 | char *fname = luaL_opt_string(1, NULL, "dofile"); | 135 | char *fname = luaL_opt_string(1, NULL); |
136 | if (lua_dofile(fname) == 0) | 136 | if (lua_dofile(fname) == 0) |
137 | if (passresults() == 0) | 137 | if (passresults() == 0) |
138 | lua_pushuserdata(NULL); /* at least one result to signal no errors */ | 138 | lua_pushuserdata(NULL); /* at least one result to signal no errors */ |
@@ -179,7 +179,7 @@ static void luaI_print (void) | |||
179 | static void luaI_type (void) | 179 | static void luaI_type (void) |
180 | { | 180 | { |
181 | lua_Object o = lua_getparam(1); | 181 | lua_Object o = lua_getparam(1); |
182 | luaL_arg_check(o != LUA_NOOBJECT, "type", 1, "no argument"); | 182 | luaL_arg_check(o != LUA_NOOBJECT, 1, "no argument"); |
183 | lua_pushstring(luaI_typenames[-ttype(luaI_Address(o))]); | 183 | lua_pushstring(luaI_typenames[-ttype(luaI_Address(o))]); |
184 | lua_pushnumber(lua_tag(o)); | 184 | lua_pushnumber(lua_tag(o)); |
185 | } | 185 | } |
@@ -212,29 +212,29 @@ static void luaI_assert (void) | |||
212 | static void luaI_setglobal (void) | 212 | static void luaI_setglobal (void) |
213 | { | 213 | { |
214 | lua_Object value = lua_getparam(2); | 214 | lua_Object value = lua_getparam(2); |
215 | luaL_arg_check(value != LUA_NOOBJECT, "setglobal", 2, NULL); | 215 | luaL_arg_check(value != LUA_NOOBJECT, 2, NULL); |
216 | lua_pushobject(value); | 216 | lua_pushobject(value); |
217 | lua_setglobal(luaL_check_string(1, "setglobal")); | 217 | lua_setglobal(luaL_check_string(1)); |
218 | lua_pushobject(value); /* return given value */ | 218 | lua_pushobject(value); /* return given value */ |
219 | } | 219 | } |
220 | 220 | ||
221 | static void luaI_rawsetglobal (void) | 221 | static void luaI_rawsetglobal (void) |
222 | { | 222 | { |
223 | lua_Object value = lua_getparam(2); | 223 | lua_Object value = lua_getparam(2); |
224 | luaL_arg_check(value != LUA_NOOBJECT, "rawsetglobal", 2, NULL); | 224 | luaL_arg_check(value != LUA_NOOBJECT, 2, NULL); |
225 | lua_pushobject(value); | 225 | lua_pushobject(value); |
226 | lua_rawsetglobal(luaL_check_string(1, "rawsetglobal")); | 226 | lua_rawsetglobal(luaL_check_string(1)); |
227 | lua_pushobject(value); /* return given value */ | 227 | lua_pushobject(value); /* return given value */ |
228 | } | 228 | } |
229 | 229 | ||
230 | static void luaI_getglobal (void) | 230 | static void luaI_getglobal (void) |
231 | { | 231 | { |
232 | lua_pushobject(lua_getglobal(luaL_check_string(1, "getglobal"))); | 232 | lua_pushobject(lua_getglobal(luaL_check_string(1))); |
233 | } | 233 | } |
234 | 234 | ||
235 | static void luaI_rawgetglobal (void) | 235 | static void luaI_rawgetglobal (void) |
236 | { | 236 | { |
237 | lua_pushobject(lua_rawgetglobal(luaL_check_string(1, "rawgetglobal"))); | 237 | lua_pushobject(lua_rawgetglobal(luaL_check_string(1))); |
238 | } | 238 | } |
239 | 239 | ||
240 | static void luatag (void) | 240 | static void luatag (void) |
@@ -249,8 +249,8 @@ static void luaI_call (void) | |||
249 | lua_Object arg = lua_getparam(2); | 249 | lua_Object arg = lua_getparam(2); |
250 | lua_Object temp, params[MAXPARAMS]; | 250 | lua_Object temp, params[MAXPARAMS]; |
251 | int narg, i; | 251 | int narg, i; |
252 | luaL_arg_check(lua_isfunction(f), "call", 1, "function expected"); | 252 | luaL_arg_check(lua_isfunction(f), 1, "function expected"); |
253 | luaL_arg_check(lua_istable(arg), "call", 2, "table expected"); | 253 | luaL_arg_check(lua_istable(arg), 2, "table expected"); |
254 | /* narg = arg.n */ | 254 | /* narg = arg.n */ |
255 | lua_pushobject(arg); | 255 | lua_pushobject(arg); |
256 | lua_pushstring("n"); | 256 | lua_pushstring("n"); |
@@ -280,9 +280,9 @@ static void luaI_call (void) | |||
280 | static void luaIl_settag (void) | 280 | static void luaIl_settag (void) |
281 | { | 281 | { |
282 | lua_Object o = lua_getparam(1); | 282 | lua_Object o = lua_getparam(1); |
283 | luaL_arg_check(o != LUA_NOOBJECT, "settag", 1, NULL); | 283 | luaL_arg_check(o != LUA_NOOBJECT, 1, NULL); |
284 | lua_pushobject(o); | 284 | lua_pushobject(o); |
285 | lua_settag(luaL_check_number(2, "settag")); | 285 | lua_settag(luaL_check_number(2)); |
286 | } | 286 | } |
287 | 287 | ||
288 | static void luaIl_newtag (void) | 288 | static void luaIl_newtag (void) |
@@ -294,8 +294,8 @@ static void rawgettable (void) | |||
294 | { | 294 | { |
295 | lua_Object t = lua_getparam(1); | 295 | lua_Object t = lua_getparam(1); |
296 | lua_Object i = lua_getparam(2); | 296 | lua_Object i = lua_getparam(2); |
297 | luaL_arg_check(t != LUA_NOOBJECT, "rawgettable", 1, NULL); | 297 | luaL_arg_check(t != LUA_NOOBJECT, 1, NULL); |
298 | luaL_arg_check(i != LUA_NOOBJECT, "rawgettable", 2, NULL); | 298 | luaL_arg_check(i != LUA_NOOBJECT, 2, NULL); |
299 | lua_pushobject(t); | 299 | lua_pushobject(t); |
300 | lua_pushobject(i); | 300 | lua_pushobject(i); |
301 | lua_pushobject(lua_rawgettable()); | 301 | lua_pushobject(lua_rawgettable()); |
@@ -307,7 +307,7 @@ static void rawsettable (void) | |||
307 | lua_Object i = lua_getparam(2); | 307 | lua_Object i = lua_getparam(2); |
308 | lua_Object v = lua_getparam(3); | 308 | lua_Object v = lua_getparam(3); |
309 | luaL_arg_check(t != LUA_NOOBJECT && i != LUA_NOOBJECT && v != LUA_NOOBJECT, | 309 | luaL_arg_check(t != LUA_NOOBJECT && i != LUA_NOOBJECT && v != LUA_NOOBJECT, |
310 | "rawsettable", 0, NULL); | 310 | 0, NULL); |
311 | lua_pushobject(t); | 311 | lua_pushobject(t); |
312 | lua_pushobject(i); | 312 | lua_pushobject(i); |
313 | lua_pushobject(v); | 313 | lua_pushobject(v); |