mirror of
https://github.com/CompeyDev/lei.git
synced 2024-12-12 12:50:42 +00:00
fix: ptr handling in int conv bindings for lua.h
This commit is contained in:
parent
0884e8d7c0
commit
e468a36ec7
1 changed files with 24 additions and 15 deletions
|
@ -203,31 +203,40 @@ func LessThan(L *LuaState, idx1, idx2 int32) bool {
|
||||||
return C.lua_lessthan(L, C.int(idx1), C.int(idx2)) != 0
|
return C.lua_lessthan(L, C.int(idx1), C.int(idx2)) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToNumberX(L *LuaState, idx int32, isnum bool) LuaNumber {
|
func ToNumberX(L *LuaState, idx int32, isnum *bool) LuaNumber {
|
||||||
isnumInner := C.int(0)
|
cisnumber := C.int(0)
|
||||||
if isnum {
|
if *isnum {
|
||||||
isnumInner = C.int(1)
|
cisnumber = C.int(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return LuaNumber(C.lua_tonumberx(L, C.int(idx), &isnumInner))
|
num := LuaNumber(C.lua_tonumberx(L, C.int(idx), &cisnumber))
|
||||||
|
*isnum = cisnumber != C.int(0)
|
||||||
|
|
||||||
|
return num
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToIntegerX(L *LuaState, idx int32, isnum bool) LuaInteger {
|
func ToIntegerX(L *LuaState, idx int32, isnum *bool) LuaInteger {
|
||||||
isnumInner := C.int(0)
|
cisnumber := C.int(0)
|
||||||
if isnum {
|
if *isnum {
|
||||||
isnumInner = C.int(1)
|
cisnumber = C.int(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return LuaInteger(C.lua_tointegerx(L, C.int(idx), &isnumInner))
|
integer := LuaInteger(C.lua_tointegerx(L, C.int(idx), &cisnumber))
|
||||||
|
*isnum = cisnumber != C.int(0)
|
||||||
|
|
||||||
|
return integer
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToUnsignedX(L *LuaState, idx int32, isnum bool) LuaUnsigned {
|
func ToUnsignedX(L *LuaState, idx int32, isnum *bool) LuaUnsigned {
|
||||||
isnumInner := C.int(0)
|
cisnumber := C.int(0)
|
||||||
if isnum {
|
if *isnum {
|
||||||
isnumInner = C.int(1)
|
cisnumber = C.int(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
return LuaUnsigned(C.lua_tounsignedx(L, C.int(idx), &isnumInner))
|
unsigned := LuaUnsigned(C.lua_tounsignedx(L, C.int(idx), &cisnumber))
|
||||||
|
*isnum = cisnumber != C.int(0)
|
||||||
|
|
||||||
|
return unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
func ToVector(L *LuaState, idx int32) {
|
func ToVector(L *LuaState, idx int32) {
|
||||||
|
|
Loading…
Reference in a new issue