Package org.keplerproject.luajava

Examples of org.keplerproject.luajava.LuaObject


  public boolean containsKey(Object key)
  {
    try
    {
      L.pushObjectValue(key);
      LuaObject obj = L.getLuaObject(-1);
      L.pop(1);
     
      LuaObject temp = L.getLuaObject(table, obj);
     
      return !temp.isNil();
    }
    catch (LuaException e)
    {
      return false;
    }
View Full Code Here


    LuaState L = LuaStateFactory.newLuaState();
    L.openBase();
   
    L.LdoString(str);

    LuaObject func = L.getLuaObject("imprime");
    Object[] teste = func.call(new Object[] { "TESTANDO"}, 2);
    System.out.println(teste[0]);
    System.out.println(teste[1]);

    System.out.println("PROXY TEST :");
    Printable p = new ObjPrint();
    p.print("TESTE 1");
    
    LuaObject o = L.getLuaObject("luaPrint");
    p = (Printable) o.createProxy("org.keplerproject.luajava.test.Printable");
    p.print("Teste 2");
   
    L.close();
  }
View Full Code Here

  /**
   * Returns a list with all the node children of the current node.
   */
  public List getChildren()
  {
    LuaObject obj = configLib.getChildren(configFile);
    List list = new ArrayList();

    int i = 1;
    obj.push();
    L.pushNumber(i);
    L.getTable(-2);
    while(!L.isNil(-1))
    {
      if(L.isTable(-1))
View Full Code Here

   * Returns a list with all the children of the current node with the name
   * <code>childName</code>.
   */
  public List getChildren(String childName)
  {
    LuaObject obj = configLib.getChildren(configFile, childName);
    List list = new ArrayList();

    int i = 1;
    obj.push();
    L.pushNumber(i);
    L.getTable(-2);
    while(!L.isNil(-1))
    {
      if(L.isTable(-1))
View Full Code Here

   
    L.LdoString(lua);
   
    for(int i = 0 ;i < 100; i++)
    {
      LuaObject obj = L.getLuaObject("tb");
      Object runnable = obj.createProxy("java.lang.Runnable");
        Thread thread = new Thread((Runnable) runnable);
      thread.start();
    }
    System.out.println("end main");
  }
View Full Code Here

    if (script instanceof String)
      L.doString((String) script);
   
    else if (script instanceof LuaObject)
    {
      LuaObject obj = (LuaObject) script;
      try
      {
        if(obj.isFunction() || obj.isUserdata() || obj.isTable())
          obj.call(new Object[] {});
      }
      catch(LuaException e)
      {
        throw new BSFException(e.getMessage());
      }
View Full Code Here

      }
    }
   
    else if (expr instanceof LuaObject)
    {
      LuaObject obj = (LuaObject) expr;
      try
      {
        if(obj.isFunction() || obj.isUserdata() || obj.isTable())
          return obj.call(new Object[] {});
      }
      catch(LuaException e)
      {
        throw new BSFException("Couldn't eval source code at line " + lineNo + " and column " + columnNo);
      }
View Full Code Here

TOP

Related Classes of org.keplerproject.luajava.LuaObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.