PageRenderTime 232ms CodeModel.GetById 18ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. require("import") -- the import fn
  2. import("smart_pointer_overload") -- import code
  3. for k,v in pairs(smart_pointer_overload) do _G[k]=v end -- move to global
  4. f = Foo()
  5. b = Bar(f)
  6. assert(f:test(3) == 1)
  7. --assert(f:test(3.5) == 2) -- won't work due to being unable to overloads
  8. assert(f:test("hello") == 3)
  9. assert(b:test(3) == 1)
  10. --assert(b:test(3.5) == 2) -- won't work due to being unable to overloads
  11. assert(b:test("hello") == 3)