bugfix #1356577, changed double=>lua_number in a few places.
added the std::pair wrapping git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8672 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
285aeff366
commit
df022e7354
6 changed files with 103 additions and 12 deletions
34
SWIG/Examples/test-suite/lua/li_std_pair_runme.lua
Normal file
34
SWIG/Examples/test-suite/lua/li_std_pair_runme.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
require("import") -- the import fn
|
||||
import("li_std_pair") -- import code
|
||||
|
||||
for k,v in pairs(li_std_pair) do _G[k]=v end -- move to global
|
||||
|
||||
intPair = makeIntPair(7, 6)
|
||||
assert(intPair.first==7 and intPair.second==6)
|
||||
|
||||
intPairPtr = makeIntPairPtr(7, 6)
|
||||
assert(intPairPtr.first==7 and intPairPtr.second==6)
|
||||
|
||||
intPairRef = makeIntPairRef(7, 6)
|
||||
assert(intPairRef.first == 7 and intPairRef.second == 6)
|
||||
|
||||
intPairConstRef = makeIntPairConstRef(7, 6)
|
||||
assert(intPairConstRef.first == 7 and intPairConstRef.second == 6)
|
||||
|
||||
-- call fns
|
||||
assert(product1(intPair) == 42)
|
||||
assert(product2(intPair) == 42)
|
||||
assert(product3(intPair) == 42)
|
||||
|
||||
-- also use the pointer version
|
||||
assert(product1(intPairPtr) == 42)
|
||||
assert(product2(intPairPtr) == 42)
|
||||
assert(product3(intPairPtr) == 42)
|
||||
|
||||
-- or the other types
|
||||
assert(product1(intPairRef) == 42)
|
||||
assert(product2(intPairRef) == 42)
|
||||
assert(product3(intPairRef) == 42)
|
||||
assert(product1(intPairConstRef) == 42)
|
||||
assert(product2(intPairConstRef) == 42)
|
||||
assert(product3(intPairConstRef) == 42)
|
||||
Loading…
Add table
Add a link
Reference in a new issue