Replies: 2 comments
-
for (Object entry : lua.toList(index)) {
workWithEntry();
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
A large part of this library is lightweight wrappers of Lua C API, with which you can do almost anything. So you might probably want try that first. Anyway: Case 1(You will need to push the table onto the Lua stack before doing the following.) There is mainly two ways: Case 2Yes, you will probably want to use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi. How to properly work with tables in LuaJava?
Case 1:
For example, I want to get all keys or values of certain table.
In vanilla Lua you can do it using
pairs
function to iterate over table.How to properly iterate over table on Java side though? Do I need to use run for that? Maybe there's more elegant solution?
Also maybe it's possible to get keys of table on C side properly without any iteration at all?
Case 2:
If I want to insert into table or sort table in Lua I can use
table.sort
andtable.insert
. But there's no hooks to do that from Java side. Should I userun
in this case too?Beta Was this translation helpful? Give feedback.
All reactions