|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.luaj.vm2.WeakTable
public class WeakTable
Subclass of LuaTable
that provides weak key and weak value semantics.
Normally these are not created directly, but indirectly when changing the mode
of a LuaTable
as lua script executes.
However, calling the constructors directly when weak tables are required from Java will reduce overhead.
Nested Class Summary | |
---|---|
static class |
WeakTable.WeakSlot
|
Constructor Summary | |
---|---|
WeakTable(boolean weakkeys,
boolean weakvalues,
LuaValue backing)
Construct a table with weak keys, weak values, or both |
Method Summary | |
---|---|
LuaValue |
arrayget(LuaValue[] array,
int index)
Returns the value at the given index in the array, or null if it is a weak reference that has been dropped. |
org.luaj.vm2.LuaTable.Slot |
entry(LuaValue key,
LuaValue value)
Return an instance of Slot appropriate for the given key and value. |
static LuaTable |
make(boolean weakkeys,
boolean weakvalues)
|
protected static LuaValue |
strengthen(java.lang.Object ref)
Unwrap a LuaValue from a WeakReference and/or WeakUserdata. |
LuaValue |
toLuaValue()
Return this metatable as a LuaValue. |
boolean |
useWeakKeys()
Return whether or not this table's keys are weak. |
boolean |
useWeakValues()
Return whether or not this table's values are weak. |
protected static LuaValue |
weaken(LuaValue value)
Self-sent message to convert a value to its weak counterpart |
LuaValue |
wrap(LuaValue value)
Returns the given value wrapped in a weak reference if appropriate. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WeakTable(boolean weakkeys, boolean weakvalues, LuaValue backing)
weakkeys
- true to let the table have weak keysweakvalues
- true to let the table have weak valuesMethod Detail |
---|
public static LuaTable make(boolean weakkeys, boolean weakvalues)
public boolean useWeakKeys()
public boolean useWeakValues()
public LuaValue toLuaValue()
public org.luaj.vm2.LuaTable.Slot entry(LuaValue key, LuaValue value)
protected static LuaValue weaken(LuaValue value)
value
- value to convert
LuaValue
that is a strong or weak reference, depending on type of value
protected static LuaValue strengthen(java.lang.Object ref)
ref
- reference to convert
weaken(LuaValue)
public LuaValue wrap(LuaValue value)
public LuaValue arrayget(LuaValue[] array, int index)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |