PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/lua/smart_pointer_overload_runme.lua

#
Lua | 14 lines | 9 code | 3 blank | 2 comment | 5 complexity | 7edc59c09720381abbb6681a2e0023fc MD5 | raw file
 1require("import")	-- the import fn
 2import("smart_pointer_overload")	-- import code
 3for k,v in pairs(smart_pointer_overload) do _G[k]=v end -- move to global
 4
 5f = Foo()
 6b = Bar(f)
 7
 8assert(f:test(3) == 1)
 9--assert(f:test(3.5) == 2)	-- won't work due to being unable to overloads
10assert(f:test("hello") == 3)
11
12assert(b:test(3) == 1)
13--assert(b:test(3.5) == 2)	-- won't work due to being unable to overloads
14assert(b:test("hello") == 3)