Lua: Fix type confusion between signed and unsigned
This bug seemed to cause all hell to break lose with negative numbers
This commit is contained in:
parent
c2e40c4cd3
commit
8ac8304824
1 changed files with 3 additions and 5 deletions
|
@ -514,7 +514,7 @@ public:
|
||||||
int toboolean(int index) { return lua_toboolean(lua_handle, index); }
|
int toboolean(int index) { return lua_toboolean(lua_handle, index); }
|
||||||
const char* tolstring(int index, size_t *len) { return lua_tolstring(lua_handle, index, len); }
|
const char* tolstring(int index, size_t *len) { return lua_tolstring(lua_handle, index, len); }
|
||||||
lua_Number tonumber(int index) { return lua_tonumber(lua_handle, index); }
|
lua_Number tonumber(int index) { return lua_tonumber(lua_handle, index); }
|
||||||
uint64_t tointeger(int index) { return LUA_INTEGER_POSTFIX(lua_to) (lua_handle, index); }
|
int64_t tointeger(int index) { return LUA_INTEGER_POSTFIX(lua_to) (lua_handle, index); }
|
||||||
void gettable(int index) { lua_gettable(lua_handle, index); }
|
void gettable(int index) { lua_gettable(lua_handle, index); }
|
||||||
int load(lua_Reader reader, void* data, const char* chunkname, const char* mode) {
|
int load(lua_Reader reader, void* data, const char* chunkname, const char* mode) {
|
||||||
(void)mode;
|
(void)mode;
|
||||||
|
@ -543,15 +543,13 @@ public:
|
||||||
template<typename T> void pushnumber(T val)
|
template<typename T> void pushnumber(T val)
|
||||||
{
|
{
|
||||||
if(std::numeric_limits<T>::is_integer || is_ss_int24<T>::flag)
|
if(std::numeric_limits<T>::is_integer || is_ss_int24<T>::flag)
|
||||||
_pushinteger(val);
|
return LUA_INTEGER_POSTFIX(lua_push) (lua_handle, val);
|
||||||
else
|
else
|
||||||
_pushnumber(val);
|
return lua_pushnumber(lua_handle, val);
|
||||||
}
|
}
|
||||||
void pushboolean(bool b) { lua_pushboolean(lua_handle, b); }
|
void pushboolean(bool b) { lua_pushboolean(lua_handle, b); }
|
||||||
void pushglobals() { LUA_LOADGLOBALS }
|
void pushglobals() { LUA_LOADGLOBALS }
|
||||||
private:
|
private:
|
||||||
void _pushnumber(lua_Number n) { return lua_pushnumber(lua_handle, n); }
|
|
||||||
void _pushinteger(uint64_t n) { return LUA_INTEGER_POSTFIX(lua_push) (lua_handle, n); }
|
|
||||||
static void builtin_oom();
|
static void builtin_oom();
|
||||||
static void builtin_soft_oom(int status);
|
static void builtin_soft_oom(int status);
|
||||||
static void* builtin_alloc(void* user, void* old, size_t olds, size_t news);
|
static void* builtin_alloc(void* user, void* old, size_t olds, size_t news);
|
||||||
|
|
Loading…
Add table
Reference in a new issue