Guest User

Untitled

a guest
Dec 6th, 2017
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. behavior_table = {}
  2.  
  3. behavior_table.doOne = function()
  4.     print('lua do a function one')
  5. end
  6.  
  7. behavior_table.customVar = 3
  8.  
  9. behavior_table.doArray = function(array)
  10.     print(behavior_table.customVar)
  11.     print("Length:", array.length)
  12.     print(array[0]) -- prints 'nil'
  13.     Coerce = luajava.bindClass("org.luaj.vm2.lib.jse.CoerceLuaToJava")
  14.     array[0] = 4 -- Throws a LuaError: index expected, got userdata
  15.     print(array[0]) -- prints 'nil'
  16.     print(Array.get(Coerce.coerce(array), 0)) -- Throws a NullPointerException
  17. end
  18.  
  19. lua_behavior = luajava.createProxy("experiment.Bobject", behavior_table)
  20.  
  21. return lua_behavior
Advertisement
Add Comment
Please, Sign In to add comment