May i override java function on luaj? #69

Closed
opened 2020-05-29 16:28:39 +00:00 by pgw00k · 2 comments
pgw00k commented 2020-05-29 16:28:39 +00:00 (Migrated from github.com)
        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?
```java 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: ```lua local task= luajava.newInstance("java.util.TimerTask") -- how override run function? ```
acanthite1855 commented 2020-11-19 10:46:54 +00:00 (Migrated from github.com)

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

@pgw00k, you need `luajava.createProxy`. Look at the [swing example](https://github.com/luaj/luaj/blob/master/examples/lua/swingapp.lua). It has exactly the same use case with the `Runnable` implementation.
pgw00k commented 2020-11-21 13:10:40 +00:00 (Migrated from github.com)

Thanks acanthite!

Thanks acanthite!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-autonomous-connection/luaj#69