本文整理了Java中org.luaj.vm2.LuaValue.typerror()
方法的一些代码示例,展示了LuaValue.typerror()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LuaValue.typerror()
方法的具体详情如下:
包路径:org.luaj.vm2.LuaValue
类名称:LuaValue
方法名:typerror
[英]Throw a LuaError indicating an invalid type was supplied to a function
[中]抛出一个LuaError,指示向函数提供的类型无效
代码示例来源:origin: M66B/XPrivacyLua
/**
* Convert this value to a string if it is a {@link LuaString} or {@link LuaNumber},
* or throw a {@link LuaError} if it is not
* @return {@link LuaString} corresponding to the value if a string or number
* @throws LuaError if not a string or number
*/
public LuaString strvalue() { typerror("strValue"); return null; }
代码示例来源:origin: hsllany/HtmlNative
/** Preallocate the array part of a table to be a certain size,
*
* Primarily used internally in response to a SETLIST bytecode.
* @param i the number of array slots to preallocate in the table.
* @throws LuaError if this is not a table.
*/
public void presize( int i) { typerror("table"); }
代码示例来源:origin: M66B/XPrivacyLua
/** Preallocate the array part of a table to be a certain size,
*
* Primarily used internally in response to a SETLIST bytecode.
* @param i the number of array slots to preallocate in the table.
* @throws LuaError if this is not a table.
*/
public void presize( int i) { typerror("table"); }
代码示例来源:origin: M66B/XPrivacyLua
/** Get raw length of table or string without metatag processing.
* @return the length of the table or string.
* @throws LuaError if {@code this} is not a table or string.
*/
public int rawlen() { typerror("table or string"); return 0; }
代码示例来源:origin: hsllany/HtmlNative
/** Get raw length of table or string without metatag processing.
* @return the length of the table or string.
* @throws LuaError if {@code this} is not a table or string.
*/
public int rawlen() { typerror("table or string"); return 0; }
代码示例来源:origin: hsllany/HtmlNative
/**
* Convert this value to a string if it is a {@link LuaString} or {@link LuaNumber},
* or throw a {@link LuaError} if it is not
* @return {@link LuaString} corresponding to the value if a string or number
* @throws LuaError if not a string or number
*/
public LuaString strvalue() { typerror("strValue"); return null; }
代码示例来源:origin: mirkosertic/GameComposer
/**
* Convert this value to a string if it is a {@link LuaString} or {@link LuaNumber},
* or throw a {@link LuaError} if it is not
* @return {@link LuaString} corresponding to the value if a string or number
* @throws LuaError if not a string or number
*/
public LuaString strvalue() { typerror("strValue"); return null; }
代码示例来源:origin: mirkosertic/GameComposer
/** Preallocate the array part of a table to be a certain size,
*
* Primarily used internally in response to a SETLIST bytecode.
* @param i the number of array slots to preallocate in the table.
* @throws LuaError if this is not a table.
*/
public void presize( int i) { typerror("table"); }
代码示例来源:origin: mirkosertic/GameComposer
/** Get raw length of table or string without metatag processing.
* @return the length of the table or string.
* @throws LuaError if {@code this} is not a table or string.
*/
public int rawlen() { typerror("table or string"); return 0; }
代码示例来源:origin: hsllany/HtmlNative
/** Find the next key,value pair if {@code this} is a table,
* return {@link #NIL} if there are no more, or throw a {@link LuaError} if not a table.
*
* To iterate over all key-value pairs in a table you can use
* {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.next(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }}
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link #NIL} to start at the beginning
* @return {@link Varargs} containing {key,value} for the next entry,
* or {@link #NIL} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable
* @see #inext(LuaValue)
* @see #valueOf(int)
* @see Varargs#arg1()
* @see Varargs#arg(int)
* @see #isnil()
*/
public Varargs next(LuaValue index) { return typerror("table"); }
代码示例来源:origin: M66B/XPrivacyLua
/** Find the next key,value pair if {@code this} is a table,
* return {@link #NIL} if there are no more, or throw a {@link LuaError} if not a table.
*
* To iterate over all key-value pairs in a table you can use
* {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.next(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }}
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link #NIL} to start at the beginning
* @return {@link Varargs} containing {key,value} for the next entry,
* or {@link #NIL} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable
* @see #inext(LuaValue)
* @see #valueOf(int)
* @see Varargs#arg1()
* @see Varargs#arg(int)
* @see #isnil()
*/
public Varargs next(LuaValue index) { return typerror("table"); }
代码示例来源:origin: mirkosertic/GameComposer
/** Find the next integer-key,value pair if {@code this} is a table,
* return {@link NIL} if there are no more, or throw a {@link LuaError} if not a table.
*
* To iterate over integer keys in a table you can use
* {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.inext(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }
* }
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link NIL} to start at the beginning
* @return {@link Varargs} containing {@code (key,value)} for the next entry,
* or {@link NONE} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable
* @see #next()
* @see #valueOf(int)
* @see Varargs#arg1()
* @see Varargs#arg(int)
* @see #isnil()
*/
public Varargs inext(LuaValue index) { return typerror("table"); }
代码示例来源:origin: hsllany/HtmlNative
/** Find the next integer-key,value pair if {@code this} is a table,
* return {@link #NIL} if there are no more, or throw a {@link LuaError} if not a table.
*
* To iterate over integer keys in a table you can use
* {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.inext(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }
* }
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link #NIL} to start at the beginning
* @return {@link Varargs} containing {@code (key,value)} for the next entry,
* or {@link #NONE} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable
* @see #next(LuaValue)
* @see #valueOf(int)
* @see Varargs#arg1()
* @see Varargs#arg(int)
* @see #isnil()
*/
public Varargs inext(LuaValue index) { return typerror("table"); }
代码示例来源:origin: M66B/XPrivacyLua
/** Find the next integer-key,value pair if {@code this} is a table,
* return {@link #NIL} if there are no more, or throw a {@link LuaError} if not a table.
*
* To iterate over integer keys in a table you can use
* {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.inext(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }
* }
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link #NIL} to start at the beginning
* @return {@link Varargs} containing {@code (key,value)} for the next entry,
* or {@link #NONE} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable
* @see #next(LuaValue)
* @see #valueOf(int)
* @see Varargs#arg1()
* @see Varargs#arg(int)
* @see #isnil()
*/
public Varargs inext(LuaValue index) { return typerror("table"); }
代码示例来源:origin: mirkosertic/GameComposer
/** Find the next key,value pair if {@code this} is a table,
* return {@link NIL} if there are no more, or throw a {@link LuaError} if not a table.
*
* To iterate over all key-value pairs in a table you can use
* {@code
* LuaValue k = LuaValue.NIL;
* while ( true ) {
* Varargs n = table.next(k);
* if ( (k = n.arg1()).isnil() )
* break;
* LuaValue v = n.arg(2)
* process( k, v )
* }}
* @param index {@link LuaInteger} value identifying a key to start from,
* or {@link NIL} to start at the beginning
* @return {@link Varargs} containing {key,value} for the next entry,
* or {@link NIL} if there are no more.
* @throws LuaError if {@code this} is not a table, or the supplied key is invalid.
* @see LuaTable
* @see #inext()
* @see #valueOf(int)
* @see Varargs#arg1()
* @see Varargs#arg(int)
* @see #isnil()
*/
public Varargs next(LuaValue index) { return typerror("table"); }
代码示例来源:origin: M66B/XPrivacyLua
/**
* Perform field assignment including metatag processing.
* @param t {@link LuaValue} on which value is being set, typically a table or something with the metatag {@link LuaValue#NEWINDEX} defined
* @param key {@link LuaValue} naming the field to assign
* @param value {@link LuaValue} the new value to assign to {@code key}
* @throws LuaError if there is a loop in metatag processing
* @return true if assignment or metatag processing succeeded, false otherwise
*/
protected static boolean settable(LuaValue t, LuaValue key, LuaValue value) {
LuaValue tm;
int loop = 0;
do {
if (t.istable()) {
if ((!t.rawget(key).isnil()) || (tm = t.metatag(NEWINDEX)).isnil()) {
t.rawset(key, value);
return true;
}
} else if ((tm = t.metatag(NEWINDEX)).isnil())
t.typerror("index");
if (tm.isfunction()) {
tm.call(t, key, value);
return true;
}
t = tm;
}
while ( ++loop
return false;
}
代码示例来源:origin: hsllany/HtmlNative
/**
* Perform field assignment including metatag processing.
* @param t {@link LuaValue} on which value is being set, typically a table or something with the metatag {@link LuaValue#NEWINDEX} defined
* @param key {@link LuaValue} naming the field to assign
* @param value {@link LuaValue} the new value to assign to {@code key}
* @throws LuaError if there is a loop in metatag processing
* @return true if assignment or metatag processing succeeded, false otherwise
*/
protected static boolean settable(LuaValue t, LuaValue key, LuaValue value) {
LuaValue tm;
int loop = 0;
do {
if (t.istable()) {
if ((!t.rawget(key).isnil()) || (tm = t.metatag(NEWINDEX)).isnil()) {
t.rawset(key, value);
return true;
}
} else if ((tm = t.metatag(NEWINDEX)).isnil())
t.typerror("index");
if (tm.isfunction()) {
tm.call(t, key, value);
return true;
}
t = tm;
}
while ( ++loop
return false;
}
代码示例来源:origin: mirkosertic/GameComposer
/**
* Perform field assignment including metatag processing.
* @param t {@link LuaValue} on which value is being set, typically a table or something with the metatag {@link LuaValue#NEWINDEX} defined
* @param key {@link LuaValue} naming the field to assign
* @param value {@link LuaValue} the new value to assign to {@code key}
* @throws LuaError if there is a loop in metatag processing
* @return true if assignment or metatag processing succeeded, false otherwise
*/
protected static boolean settable(LuaValue t, LuaValue key, LuaValue value) {
LuaValue tm;
int loop = 0;
do {
if (t.istable()) {
if ((!t.rawget(key).isnil()) || (tm = t.metatag(NEWINDEX)).isnil()) {
t.rawset(key, value);
return true;
}
} else if ((tm = t.metatag(NEWINDEX)).isnil())
t.typerror("index");
if (tm.isfunction()) {
tm.call(t, key, value);
return true;
}
t = tm;
}
while ( ++loop
return false;
}