how can i register a java function in lua ? #122
Answered
by
gudzpoz
skinkairewalker
asked this question in
Q&A
-
hello everyone ! |
Beta Was this translation helpful? Give feedback.
Answered by
gudzpoz
Sep 3, 2023
Replies: 1 comment
-
I don't think there is a universal way to do this. But Function<String, String> f = (s) -> s + s;
L.push(f);
L.setGlobal("obj");
L.run("function f(s) obj:apply(s) end") |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
skinkairewalker
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think there is a universal way to do this. But
push
ing the corresponding object,setGlobal
to assign it to a global variable and wrapping it up with a Lua function should work: