diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-26 15:48:35 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-04-26 15:48:35 -0300 |
| commit | eee51492e26bc295d2b67b91aa7bdb97a21e3623 (patch) | |
| tree | 694f60a1200a517f4aa1b5dfc377b7c759d2dbf0 /lundump.c | |
| parent | c37b7b3cca3f58389aefb3903b58fd213bae2b16 (diff) | |
| download | lua-eee51492e26bc295d2b67b91aa7bdb97a21e3623.tar.gz lua-eee51492e26bc295d2b67b91aa7bdb97a21e3623.tar.bz2 lua-eee51492e26bc295d2b67b91aa7bdb97a21e3623.zip | |
dumping and undumping integers
Diffstat (limited to 'lundump.c')
| -rw-r--r-- | lundump.c | 16 |
1 files changed, 13 insertions, 3 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lundump.c,v 2.21 2012/03/19 22:58:09 roberto Exp roberto $ | 2 | ** $Id: lundump.c,v 2.22 2012/05/08 13:53:33 roberto Exp roberto $ |
| 3 | ** load precompiled Lua chunks | 3 | ** load precompiled Lua chunks |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -69,6 +69,13 @@ static lua_Number LoadNumber(LoadState* S) | |||
| 69 | return x; | 69 | return x; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | static lua_Integer LoadInteger(LoadState* S) | ||
| 73 | { | ||
| 74 | lua_Integer x; | ||
| 75 | LoadVar(S,x); | ||
| 76 | return x; | ||
| 77 | } | ||
| 78 | |||
| 72 | static TString* LoadString(LoadState* S) | 79 | static TString* LoadString(LoadState* S) |
| 73 | { | 80 | { |
| 74 | size_t size; | 81 | size_t size; |
| @@ -112,10 +119,13 @@ static void LoadConstants(LoadState* S, Proto* f) | |||
| 112 | case LUA_TBOOLEAN: | 119 | case LUA_TBOOLEAN: |
| 113 | setbvalue(o,LoadChar(S)); | 120 | setbvalue(o,LoadChar(S)); |
| 114 | break; | 121 | break; |
| 115 | case LUA_TNUMBER: | 122 | case LUA_TNUMFLT: |
| 116 | setnvalue(o,LoadNumber(S)); | 123 | setnvalue(o,LoadNumber(S)); |
| 117 | break; | 124 | break; |
| 118 | case LUA_TSTRING: | 125 | case LUA_TNUMINT: |
| 126 | setivalue(o,LoadInteger(S)); | ||
| 127 | break; | ||
| 128 | case LUA_TSHRSTR: case LUA_TLNGSTR: | ||
| 119 | setsvalue2n(S->L,o,LoadString(S)); | 129 | setsvalue2n(S->L,o,LoadString(S)); |
| 120 | break; | 130 | break; |
| 121 | default: lua_assert(0); | 131 | default: lua_assert(0); |
