mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
lua: Allow regular int to be passed as a 64 bit integer.
This commit is contained in:
@@ -645,10 +645,19 @@ get_int64 (lua_State *L, int index)
|
||||
int64_t r;
|
||||
const char *s;
|
||||
|
||||
s = luaL_checkstring (L, index);
|
||||
if (sscanf (s, \"%%\" SCNi64, &r) != 1)
|
||||
return luaL_error (L, \"int64 parameter expected\");
|
||||
return r;
|
||||
switch (lua_type (L, index)) {
|
||||
case LUA_TSTRING:
|
||||
s = luaL_checkstring (L, index);
|
||||
if (sscanf (s, \"%%\" SCNi64, &r) != 1)
|
||||
return luaL_error (L, \"int64 parameter expected\");
|
||||
return r;
|
||||
|
||||
case LUA_TNUMBER:
|
||||
return luaL_checkint (L, index);
|
||||
|
||||
default:
|
||||
return luaL_error (L, \"expecting 64 bit integer\");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user