diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-31 17:59:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1997-03-31 17:59:09 -0300 |
commit | efaaf99c425db615e63b6c5ee56c2878a592e2fa (patch) | |
tree | d8d027e29e98d982b67f645e42fa38c0cc2bde32 /inout.c | |
parent | f8a571ee356f386ed7b5af898c2d297fd6d295fd (diff) | |
download | lua-efaaf99c425db615e63b6c5ee56c2878a592e2fa.tar.gz lua-efaaf99c425db615e63b6c5ee56c2878a592e2fa.tar.bz2 lua-efaaf99c425db615e63b6c5ee56c2878a592e2fa.zip |
first version of "setglobal" and "getglobal" internal methods.
Diffstat (limited to 'inout.c')
-rw-r--r-- | inout.c | 30 |
1 files changed, 23 insertions, 7 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.48 1997/03/20 19:20:23 roberto Exp roberto $"; | 8 | char *rcs_inout="$Id: inout.c,v 2.49 1997/03/31 14:17:09 roberto Exp roberto $"; |
9 | 9 | ||
10 | #include <stdio.h> | 10 | #include <stdio.h> |
11 | #include <string.h> | 11 | #include <string.h> |
@@ -194,11 +194,25 @@ static void luaI_setglobal (void) | |||
194 | lua_pushobject(value); /* return given value */ | 194 | lua_pushobject(value); /* return given value */ |
195 | } | 195 | } |
196 | 196 | ||
197 | static void luaI_basicsetglobal (void) | ||
198 | { | ||
199 | lua_Object value = lua_getparam(2); | ||
200 | luaL_arg_check(value != LUA_NOOBJECT, "basicsetglobal", 2, NULL); | ||
201 | lua_pushobject(value); | ||
202 | lua_basicstoreglobal(luaL_check_string(1, "basicsetglobal")); | ||
203 | lua_pushobject(value); /* return given value */ | ||
204 | } | ||
205 | |||
197 | static void luaI_getglobal (void) | 206 | static void luaI_getglobal (void) |
198 | { | 207 | { |
199 | lua_pushobject(lua_getglobal(luaL_check_string(1, "getglobal"))); | 208 | lua_pushobject(lua_getglobal(luaL_check_string(1, "getglobal"))); |
200 | } | 209 | } |
201 | 210 | ||
211 | static void luaI_basicgetglobal (void) | ||
212 | { | ||
213 | lua_pushobject(lua_basicgetglobal(luaL_check_string(1, "basicgetglobal"))); | ||
214 | } | ||
215 | |||
202 | #define MAXPARAMS 256 | 216 | #define MAXPARAMS 256 |
203 | static void luaI_call (void) | 217 | static void luaI_call (void) |
204 | { | 218 | { |
@@ -281,27 +295,29 @@ static struct { | |||
281 | lua_CFunction func; | 295 | lua_CFunction func; |
282 | } int_funcs[] = { | 296 | } int_funcs[] = { |
283 | {"assert", luaI_assert}, | 297 | {"assert", luaI_assert}, |
284 | {"call", luaI_call}, | 298 | {"basicgetglobal", luaI_basicgetglobal}, |
285 | {"basicindex", basicindex}, | 299 | {"basicindex", basicindex}, |
300 | {"basicsetglobal", luaI_basicsetglobal}, | ||
286 | {"basicstoreindex", basicstoreindex}, | 301 | {"basicstoreindex", basicstoreindex}, |
287 | {"settag", luaIl_settag}, | 302 | {"call", luaI_call}, |
288 | {"dofile", lua_internaldofile}, | 303 | {"dofile", lua_internaldofile}, |
289 | {"dostring", lua_internaldostring}, | 304 | {"dostring", lua_internaldostring}, |
290 | {"error", luaI_error}, | 305 | {"error", luaI_error}, |
291 | {"getglobal", luaI_getglobal}, | 306 | {"getglobal", luaI_getglobal}, |
307 | {"newtag", luaIl_newtag}, | ||
292 | {"next", lua_next}, | 308 | {"next", lua_next}, |
293 | {"nextvar", luaI_nextvar}, | 309 | {"nextvar", luaI_nextvar}, |
294 | {"newtag", luaIl_newtag}, | ||
295 | {"print", luaI_print}, | 310 | {"print", luaI_print}, |
311 | {"seterrormethod", luaI_seterrormethod}, | ||
296 | {"setfallback", luaI_setfallback}, | 312 | {"setfallback", luaI_setfallback}, |
297 | {"setintmethod", luaI_setintmethod}, | ||
298 | {"setglobalmethod", luaI_setglobalmethod}, | ||
299 | {"setglobal", luaI_setglobal}, | 313 | {"setglobal", luaI_setglobal}, |
314 | {"setintmethod", luaI_setintmethod}, | ||
315 | {"settag", luaIl_settag}, | ||
300 | {"tonumber", lua_obj2number}, | 316 | {"tonumber", lua_obj2number}, |
301 | {"tostring", luaI_tostring}, | 317 | {"tostring", luaI_tostring}, |
302 | {"type", luaI_type} | 318 | {"type", luaI_type} |
303 | }; | 319 | }; |
304 | 320 | ||
305 | #define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0])) | 321 | #define INTFUNCSIZE (sizeof(int_funcs)/sizeof(int_funcs[0])) |
306 | 322 | ||
307 | 323 | ||