diff options
| -rw-r--r-- | table.c | 28 |
1 files changed, 3 insertions, 25 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** Module to control static tables | 3 | ** Module to control static tables |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_table="$Id: table.c,v 2.41 1996/01/22 17:40:00 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.42 1996/01/23 18:39:45 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | /*#include <string.h>*/ | 8 | /*#include <string.h>*/ |
| 9 | 9 | ||
| @@ -33,8 +33,6 @@ static Long lua_maxconstant = 0; | |||
| 33 | #define MIN_GARBAGE_BLOCK (GARBAGE_BLOCK/2) | 33 | #define MIN_GARBAGE_BLOCK (GARBAGE_BLOCK/2) |
| 34 | 34 | ||
| 35 | static void lua_nextvar (void); | 35 | static void lua_nextvar (void); |
| 36 | static void setglobal (void); | ||
| 37 | static void getglobal (void); | ||
| 38 | 36 | ||
| 39 | /* | 37 | /* |
| 40 | ** Initialise symbol table with internal functions | 38 | ** Initialise symbol table with internal functions |
| @@ -57,9 +55,9 @@ static void lua_initsymbol (void) | |||
| 57 | n = luaI_findsymbolbyname("dofile"); | 55 | n = luaI_findsymbolbyname("dofile"); |
| 58 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = lua_internaldofile; | 56 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = lua_internaldofile; |
| 59 | n = luaI_findsymbolbyname("setglobal"); | 57 | n = luaI_findsymbolbyname("setglobal"); |
| 60 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = setglobal; | 58 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_setglobal; |
| 61 | n = luaI_findsymbolbyname("getglobal"); | 59 | n = luaI_findsymbolbyname("getglobal"); |
| 62 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = getglobal; | 60 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_getglobal; |
| 63 | n = luaI_findsymbolbyname("type"); | 61 | n = luaI_findsymbolbyname("type"); |
| 64 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_type; | 62 | s_tag(n) = LUA_T_CFUNCTION; s_fvalue(n) = luaI_type; |
| 65 | n = luaI_findsymbolbyname("tostring"); | 63 | n = luaI_findsymbolbyname("tostring"); |
| @@ -246,26 +244,6 @@ static void lua_nextvar (void) | |||
| 246 | } | 244 | } |
| 247 | 245 | ||
| 248 | 246 | ||
| 249 | static void setglobal (void) | ||
| 250 | { | ||
| 251 | lua_Object name = lua_getparam(1); | ||
| 252 | lua_Object value = lua_getparam(2); | ||
| 253 | if (!lua_isstring(name)) | ||
| 254 | lua_error("incorrect argument to function `setglobal'"); | ||
| 255 | lua_pushobject(value); | ||
| 256 | lua_storeglobal(lua_getstring(name)); | ||
| 257 | } | ||
| 258 | |||
| 259 | |||
| 260 | static void getglobal (void) | ||
| 261 | { | ||
| 262 | lua_Object name = lua_getparam(1); | ||
| 263 | if (!lua_isstring(name)) | ||
| 264 | lua_error("incorrect argument to function `getglobal'"); | ||
| 265 | lua_pushobject(lua_getglobal(lua_getstring(name))); | ||
| 266 | } | ||
| 267 | |||
| 268 | |||
| 269 | static Object *functofind; | 247 | static Object *functofind; |
| 270 | static int checkfunc (Object *o) | 248 | static int checkfunc (Object *o) |
| 271 | { | 249 | { |
