Guest User

Untitled

a guest
Jun 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. struct A {
  2. virtual void foo() = 0;
  3. };
  4.  
  5. void do_something(A* a) {
  6. a->foo();
  7. }
  8.  
  9. class 'MyA' (A)
  10. ....
  11. function MyA:foo()
  12. print('hi')
  13. end
  14.  
  15. ... // somehow create an instance of MyA class and named myA
  16. // How?
  17. // Maybe the result of a call to "MyA()"?
  18.  
  19. do_something(myA);
  20.  
  21. // C++
  22. struct LuaA : public A
  23. {
  24. LuaA(const std::string &luacode)
  25. : myLuaHandler(luacode)
  26. {
  27. }
  28.  
  29. virtual void foo()
  30. {
  31. myLuaHandler.call("MyA:foo()");
  32. }
  33. }
  34.  
  35. virtual void f(int a)
  36. {
  37. call<void>("f", a);
  38. }
Add Comment
Please, Sign In to add comment