luaj icon indicating copy to clipboard operation
luaj copied to clipboard

May i override java function on luaj?

Open pgw00k opened this issue 5 years ago • 2 comments

        TimerTask task = new TimerTask() {
            @Override
            public void run() {
                /**
                 * do somthing
                 */
                Log.d("task","Try Do");
            }
        };

May I do like java on lua? And how? just like:

local task= luajava.newInstance("java.util.TimerTask")
-- how override run function?

pgw00k avatar May 29 '20 16:05 pgw00k

@pgw00k, you need luajava.createProxy. Look at the swing example. It has exactly the same use case with the Runnable implementation.

acanthite1855 avatar Nov 19 '20 10:11 acanthite1855

Thanks acanthite!

pgw00k avatar Nov 21 '20 13:11 pgw00k