[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaJava - How to pass Java objects to functions?
- From: "Jarrod H. Roberson" <vertigrated@...>
- Date: Tue, 16 Dec 2003 14:11:10 -0500 (EST)
Using the example code that Danilo so graciously provided, I understand
how that works, now I want to pass a Java object manipulate it and pass it
back.
I basically in Lua code I want to test the TestDataObject accessors for
certain values and change them in lua and then pass back the changes to
the Java program.
I can't figure out the syntax on either side as I can't find a good
concrete example.
BTW: all this will be composed into a tutorial for the wiki as soon as I
understand it all :)
Thanks for all the help!
// I changed the interface to be like this
public interface IBusinessLogic
{
public TestDataObject doLogic( TestDataObject test );
}
//Here is the object
public class TestDataObject
{
private String s1;
private boolean b1;
private int i1;
public TestDataObject(String s, int i, boolean b)
{
this.s1 = s;
this.i1 = i;
this.b1 = b;
}
public void setBoolean(boolean b)
{
this.b1 = b;
}
public boolean isBoolean()
{
return this.b1;
}
public void setIint(int i)
{
this.i1 = i;
}
public int getInt()
{
return this.i1;
}
public void setString(String s1)
{
this.s1 = s1;
}
public String getString()
{
return this.s1;
}
public String toString()
{
return this.s1 + ":" + this.i1 + ":" + this.b1;
}
}
=========================================
--
Jarrod H. Roberson