diff options
| author | valid-ptr <konstantin.matveyev@eligovision.ru> | 2021-02-24 19:04:23 +0300 |
|---|---|---|
| committer | Konstantin S. Matveyev <kos@eligovision.ru> | 2021-02-24 19:13:22 +0300 |
| commit | a9daf44c335351366b96f2971b2f8acc227430b1 (patch) | |
| tree | 160354cab3a9856ead9e74df24bcb4f445caaa0a /src | |
| parent | 1d255d1d5f55584626ae247610f379ccdb8f2ec5 (diff) | |
| download | lanes-a9daf44c335351366b96f2971b2f8acc227430b1.tar.gz lanes-a9daf44c335351366b96f2971b2f8acc227430b1.tar.bz2 lanes-a9daf44c335351366b96f2971b2f8acc227430b1.zip | |
Compat lua_setiuservalue fixed for Lua 5.1 and LuaJIT
Diffstat (limited to 'src')
| -rw-r--r-- | src/compat.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/compat.c b/src/compat.c index bccd05f..d9bc3dd 100644 --- a/src/compat.c +++ b/src/compat.c | |||
| @@ -78,11 +78,16 @@ int lua_getiuservalue( lua_State* L, int idx, int n) | |||
| 78 | 78 | ||
| 79 | int lua_setiuservalue( lua_State* L, int idx, int n) | 79 | int lua_setiuservalue( lua_State* L, int idx, int n) |
| 80 | { | 80 | { |
| 81 | if( n > 1) | 81 | if( n > 1 |
| 82 | #if LUA_VERSION_NUM == 501 | ||
| 83 | || lua_type( L, -1) != LUA_TTABLE | ||
| 84 | #endif | ||
| 85 | ) | ||
| 82 | { | 86 | { |
| 83 | lua_pop( L, 1); | 87 | lua_pop( L, 1); |
| 84 | return 0; | 88 | return 0; |
| 85 | } | 89 | } |
| 90 | |||
| 86 | (void) lua_setuservalue( L, idx); | 91 | (void) lua_setuservalue( L, idx); |
| 87 | return 1; // I guess anything non-0 is ok | 92 | return 1; // I guess anything non-0 is ok |
| 88 | } | 93 | } |
