Guest User

@makiolo lua test

a guest
Jun 28th, 2011
245
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. entero_lua = 3
  2. real_lua = 5.2
  3.  
  4. function hola_mundo_lua()
  5.     print("[LUA] Ejecutando Lua hola_mundo_lua()")
  6. end
  7.  
  8. function suma_lua(a, b)
  9.     print("[LUA] Ejecutando suma_cpp(int, int) con parametros "..a.." y "..b)
  10.     return a + b
  11. end
  12.  
  13. ----- MAIN ------
  14. --[[
  15. En multilinea se comenta así
  16. --]]
  17.  
  18. hola_mundo_cpp()
  19. hola_mundo_lua()
  20. a = suma_cpp(1,3)
  21. b = suma_lua(1,3)
  22. assert(a == b)
  23. print ("[LUA] Resultado recogido en c++ = "..a)
  24. print ("[LUA] Resultado recogido en lua = "..b)
  25.  
  26. -- crear clases desde Lua, se encarga de liberar el recolector de basura de Lua
  27. -- Pero os recomiendo bindear con manager singleton que se encarga de la creacion/destrucción desde C++
  28. -- En plan: MathManager:crearVector2(x,x)
  29. v1 = Vector2(0, 0)
  30. v2 = Vector2(2, 2)
  31.  
  32. -- ojo, se usa ":" para llamar a métodos
  33. print ("[LUA] Módulo v1 = "..v1:length())
  34. print ("[LUA] Módulo v2 = "..v2:length())
  35.  
  36. v1:polimorfico_test()
  37. v1:polimorfico_test(2)
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×