diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-02 17:37:04 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-02 17:37:04 -0300 |
| commit | 02a6891939895129bc968364a5beda73331005e7 (patch) | |
| tree | 61417ec2d6e1eb38542e04fba31c482c6284280b /lstate.c | |
| parent | 741c6f50067bfb0f351967c321da56805191f302 (diff) | |
| download | lua-02a6891939895129bc968364a5beda73331005e7.tar.gz lua-02a6891939895129bc968364a5beda73331005e7.tar.bz2 lua-02a6891939895129bc968364a5beda73331005e7.zip | |
API for functions to manipulate global state.
Diffstat (limited to 'lstate.c')
| -rw-r--r-- | lstate.c | 14 |
1 files changed, 11 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.c,v 1.4 1997/12/11 14:48:46 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -17,13 +17,13 @@ | |||
| 17 | #include "ltm.h" | 17 | #include "ltm.h" |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | LState *lua_state = NULL; | 20 | lua_State *lua_state = NULL; |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | void lua_open (void) | 23 | void lua_open (void) |
| 24 | { | 24 | { |
| 25 | if (lua_state) return; | 25 | if (lua_state) return; |
| 26 | lua_state = luaM_new(LState); | 26 | lua_state = luaM_new(lua_State); |
| 27 | L->numCblocks = 0; | 27 | L->numCblocks = 0; |
| 28 | L->Cstack.base = 0; | 28 | L->Cstack.base = 0; |
| 29 | L->Cstack.lua2C = 0; | 29 | L->Cstack.lua2C = 0; |
| @@ -76,3 +76,11 @@ void lua_close (void) | |||
| 76 | printf("total de memoria: %ld\n", totalmem); | 76 | printf("total de memoria: %ld\n", totalmem); |
| 77 | #endif | 77 | #endif |
| 78 | } | 78 | } |
| 79 | |||
| 80 | |||
| 81 | lua_State *lua_setstate (lua_State *st) { | ||
| 82 | lua_State *old = lua_state; | ||
| 83 | lua_state = st; | ||
| 84 | return old; | ||
| 85 | } | ||
| 86 | |||
