Is there a way to serialize a LuaClosure? #90

Closed
opened 2021-06-03 18:30:18 +00:00 by LittleFogCat · 0 comments
LittleFogCat commented 2021-06-03 18:30:18 +00:00 (Migrated from github.com)

Here I have a lua script returns a function to Java (as LuaClosure) and I want to store it locally for furthur use. Is there any way without reload the source lua file?

Typically it's like this:

-- do something

return function()
    print("foo")
end

Handle in Java:

LuaClosure func = (LuaClosure) globals.load(source).call();
// serialize it here
Here I have a lua script returns a function to Java (as `LuaClosure`) and I want to store it locally for furthur use. Is there any way without reload the source lua file? Typically it's like this: ```lua -- do something return function() print("foo") end ``` Handle in Java: ```java LuaClosure func = (LuaClosure) globals.load(source).call(); // serialize it here ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: open-autonomous-connection/luaj#90