Package party.iroiro.luajava.value
Interface LuaTableTrait
- All Known Subinterfaces:
LuaValue
- All Known Implementing Classes:
AbstractLuaValue,AbstractRefLuaValue,ImmutableLuaValue,LuaTableValue,RefLuaValue
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionget(int i) Gets the value at the specified integer index from the table.Gets the value at the specified string key from the table.Gets the value at the specified Lua value key from the table.intlength()Returns the length of the array part of this Lua table.PerformsthisLuaValue[key] = valueSimilar toset(Object, Object)Similar toput(LuaValue, LuaValue), but handles other Java types as wellintsize()Returns the size of this Lua table.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, values
-
Method Details
-
length
int length()Returns the length of the array part of this Lua table.- Returns:
- the length as would be returned by the Lua
#operator
-
size
int size()Returns the size of this Lua table.Please note that Lua does not offer a method to get the size of a table, so this function will need to iterate over it to calculate the size.
-
get
Gets the value at the specified integer index from the table.- Parameters:
i- the index- Returns:
thisLuaValue[i]
-
get
-
get
Gets the value at the specified string key from the table.- Parameters:
key- the key- Returns:
thisLuaValue[key]
-
get
Gets the value at the specified Lua value key from the table.- Parameters:
key- the key- Returns:
thisLuaValue[key]
-
set
Similar toset(Object, Object)- Parameters:
key- the keyvalue- the value, either aLuaValuetype or any Java object- Returns:
- the previous value
-
set
Similar toput(LuaValue, LuaValue), but handles other Java types as well -
put
PerformsthisLuaValue[key] = value
-