Comments (4)
Here is an example:
String program = "function dummy(a,b) print('a=',a,'b=',b); end";
// compile the program
StateContext state = StateContexts.newDefaultInstance();
Table env = StandardLibrary.in(RuntimeEnvironments.system()).installInto(state);
ChunkLoader loader = CompilerChunkLoader.of("MyDummyMainProgram");
LuaFunction main = loader.loadTextChunk(new Variable(env), "MyDummyChunk", program);
// run program in order to declare the "dummy" function
DirectCallExecutor.newExecutor().call(state, main);
// get a reference to the function
LuaFunction dummy = (LuaFunction)env.rawget("dummy");
// call it
String a = "hello";
String b = "world!";
DirectCallExecutor.newExecutor().call(state, dummy, a, b);
from rembulan.
Just catch the return values of the last statement.
from rembulan.
Nice, thank you! Do you happen to know how I would get the return value from a function call?
from rembulan.
Excellent. Thank you. 👍
from rembulan.
Related Issues (20)
- Implement the package library HOT 1
- Add file and line information to exceptions thrown from Lua HOT 1
- Implement the utf8 module
- Consider adding a compatibility layer for Lua 5.1 and 5.2 HOT 1
- Consider using capsule as a packager? HOT 2
- Add support for binary chunks
- Avoid unnecessary boxing and unboxing in the generated code
- Use raw table access for fresh tables in the generated code
- JSR 223 HOT 5
- InvalidPathException when requiring invalid path
- String match does not support ([^05+]) form
- Load from InputStream
- Performance comparsion with LuaJ HOT 1
- Question: Is this project still alive? HOT 13
- CallException: net.sandius.rembulan.lib.BadArgumentException: bad argument #1 to 'ipairs' (table expected, got light userdata) HOT 1
- Generated byte code uses incorrect table object when indexing the result of a function HOT 1
- How to compile *.lua to *.class? HOT 2
- There is a potential runtime exception
- Why `createProxy` is not implemented?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rembulan.