# Varargs (Luaj API)
Date: 2015-04-29

## org.luaj.vm2
Class Varargs

    java.lang.Object
      org.luaj.vm2.Varargs

Direct Known Subclasses:
  LuaValue, TailcallVarargs

    public abstract class Varargs

extends java.lang.Object

Class to encapsulate varargs values, either as part of a variable argument list, or multiple return values.

To construct varargs, use one of the static methods such as `LuaValue.varargsOf(LuaValue,LuaValue)`

Any LuaValue can be used as a stand-in for Varargs, for both calls and return values. When doing so, nargs() will return 1 and arg1() or arg(1) will return this. This simplifies the case when calling or implementing varargs functions with only 1 argument or 1 return value.

Varargs can also be derived from other varargs by appending to the front with a call such as `LuaValue.varargsOf(LuaValue,Varargs)` or by taking a portion of the args using `Varargs.subargs(int start)`

See Also:
  `LuaValue.varargsOf(LuaValue[])`, `LuaValue.varargsOf(LuaValue, Varargs)`, `LuaValue.varargsOf(LuaValue[], Varargs)`, `LuaValue.varargsOf(LuaValue, LuaValue, Varargs)`, `LuaValue.varargsOf(LuaValue[], int, int)`, `LuaValue.varargsOf(LuaValue[], int, int, Varargs)`, `LuaValue.subargs(int)`

Constructor Summary
`Varargs()`

Method Summary
`abstract LuaValue` `arg(int i)` Get the n-th argument value (1-based).
`abstract LuaValue` `arg1()` Get the first argument in the list.
`void` `argcheck(boolean test, int i, java.lang.String msg)` Performs test on argument i as a LuaValue when a user-supplied assertion passes, or throw an error.
`boolean` `checkboolean(int i)` Return argument i as a boolean value, or throw an error if any other type.
`LuaClosure` `checkclosure(int i)` Return argument i as a closure, or throw an error if any other type.
`double` `checkdouble(int i)` Return argument i as a double, or throw an error if it cannot be converted to one.
`LuaFunction` `checkfunction(int i)` Return argument i as a function, or throw an error if an incompatible type.
`int` `checkint(int i)` Return argument i as a java int value, discarding any fractional part, or throw an error if not a number.
`LuaInteger` `checkinteger(int i)` Return argument i as a java int value, or throw an error if not a number or is not representable by a java int.
`java.lang.String` `checkjstring(int i)` Return argument i as a java String if a string or number, or throw an error if any other type
`long` `checklong(int i)` Return argument i as a java long value, discarding any fractional part, or throw an error if not a number.
`LuaValue` `checknotnil(int i)` Return argument i as a LuaValue if it is not nil, or throw an error if it is nil.
`LuaNumber` `checknumber(int i)` Return argument i as a LuaNumber, or throw an error if not a number or string that can be converted to a number.
`LuaString` `checkstring(int i)` Return argument i as a LuaString if a string or number, or throw an error if any other type
`LuaTable` `checktable(int i)` Return argument i as a LuaTable if a lua table, or throw an error if any other type.
`LuaThread` `checkthread(int i)` Return argument i as a LuaThread if a lua thread, or throw an error if any other type.
`java.lang.Object` `checkuserdata(int i)` Return argument i as a java Object if a userdata, or throw an error if any other type.
`java.lang.Object` `checkuserdata(int i, java.lang.Class c)` Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, or throw an error if any other type.
`LuaValue` `checkvalue(int i)` Return argument i as a LuaValue if it exists, or throw an error.
`Varargs` `eval()` Evaluate any pending tail call and return result.
`boolean` `isfunction(int i)` Tests if argument i is a function.
`boolean` `isnil(int i)` Tests if argument i is nil.
`boolean` `isnoneornil(int i)` Return true if there is no argument or nil at argument i.
`boolean` `isnumber(int i)` Tests if argument i is a number.
`boolean` `isstring(int i)` Tests if argument i is a string.
`boolean` `istable(int i)` Tests if argument i is a table.
`boolean` `isTailcall()` Return true if this is a TailcallVarargs
`boolean` `isthread(int i)` Tests if argument i is a thread.
`boolean` `isuserdata(int i)` Tests if argument i is a userdata.
`boolean` `isvalue(int i)` Tests if a value exists at argument i.
`abstract int` `narg()` Get the number of arguments, or 0 if there are none.
`boolean` `optboolean(int i, boolean defval)` Return argument i as a boolean value, `defval` if nil, or throw a LuaError if any other type.
`LuaClosure` `optclosure(int i, LuaClosure defval)` Return argument i as a closure, `defval` if nil, or throw a LuaError if any other type.
`double` `optdouble(int i, double defval)` Return argument i as a double, `defval` if nil, or throw a LuaError if it cannot be converted to one.
`LuaFunction` `optfunction(int i, LuaFunction defval)` Return argument i as a function, `defval` if nil, or throw a LuaError if an incompatible type.
`int` `optint(int i, int defval)` Return argument i as a java int value, discarding any fractional part, `defval` if nil, or throw a LuaError if not a number.
`LuaInteger` `optinteger(int i, LuaInteger defval)` Return argument i as a java int value, `defval` if nil, or throw a LuaError if not a number or is not representable by a java int.
`java.lang.String` `optjstring(int i, java.lang.String defval)` Return argument i as a java String if a string or number, `defval` if nil, or throw a LuaError if any other type
`long` `optlong(int i, long defval)` Return argument i as a java long value, discarding any fractional part, `defval` if nil, or throw a LuaError if not a number.
`LuaNumber` `optnumber(int i, LuaNumber defval)` Return argument i as a LuaNumber, `defval` if nil, or throw a LuaError if not a number or string that can be converted to a number.
`LuaString` `optstring(int i, LuaString defval)` Return argument i as a LuaString if a string or number, `defval` if nil, or throw a LuaError if any other type
`LuaTable` `opttable(int i, LuaTable defval)` Return argument i as a LuaTable if a lua table, `defval` if nil, or throw a LuaError if any other type.
`LuaThread` `optthread(int i, LuaThread defval)` Return argument i as a LuaThread if a lua thread, `defval` if nil, or throw a LuaError if any other type.
`java.lang.Object` `optuserdata(int i, java.lang.Class c, java.lang.Object defval)` Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, `defval` if nil, or throw a LuaError if any other type.
`java.lang.Object` `optuserdata(int i, java.lang.Object defval)` Return argument i as a java Object if a userdata, `defval` if nil, or throw a LuaError if any other type.
`LuaValue` `optvalue(int i, LuaValue defval)` Return argument i as a LuaValue if it exists, or `defval`.
`abstract Varargs` `subargs(int start)` Create a `Varargs` instance containing arguments starting at index `start`
`boolean` `toboolean(int i)` Convert argument `i` to java boolean based on lua rules for boolean evaluation.
`byte` `tobyte(int i)` Return argument i as a java byte value, discarding any fractional part and truncating, or 0 if not a number.
`char` `tochar(int i)` Return argument i as a java char value, discarding any fractional part and truncating, or 0 if not a number.
`double` `todouble(int i)` Return argument i as a java double value or 0 if not a number.
`float` `tofloat(int i)` Return argument i as a java float value, discarding excess fractional part and truncating, or 0 if not a number.
`int` `toint(int i)` Return argument i as a java int value, discarding any fractional part and truncating, or 0 if not a number.
`java.lang.String` `tojstring()` Convert the list of varargs values to a human readable java String.
`java.lang.String` `tojstring(int i)` Return argument i as a java String based on the type of the argument.
`long` `tolong(int i)` Return argument i as a java long value, discarding any fractional part and truncating, or 0 if not a number.
`short` `toshort(int i)` Return argument i as a java short value, discarding any fractional part and truncating, or 0 if not a number.
`java.lang.String` `toString()` Convert the value or values to a java String using Varargs.tojstring()
`java.lang.Object` `touserdata(int i)` Return argument i as a java Object if a userdata, or null.
`java.lang.Object` `touserdata(int i, java.lang.Class c)` Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, or null.
`int` `type(int i)` Gets the type of argument `i`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Varargs

    public Varargs()

Method Detail

### arg

    public abstract LuaValue arg(int i)

  Get the n-th argument value (1-based).

  Parameters:
    `i` - the index of the argument to get, 1 is the first argument
  Returns:
    Value at position i, or LuaValue.NIL if there is none.
  See Also:
    `arg1()`, `LuaValue.NIL`

### narg

    public abstract int narg()

  Get the number of arguments, or 0 if there are none.

  Returns:
    number of arguments.

### arg1

    public abstract LuaValue arg1()

  Get the first argument in the list.

  Returns:
    LuaValue which is first in the list, or LuaValue.NIL if there are no values.
  See Also:
    `arg(int)`, `LuaValue.NIL`

### eval

    public Varargs eval()

  Evaluate any pending tail call and return result.

  Returns:
    the evaluated tail call result

### isTailcall

    public boolean isTailcall()

  Return true if this is a TailcallVarargs

  Returns:
    true if a tail call, false otherwise

### type

    public int type(int i)

  Gets the type of argument `i`

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    int value corresponding to one of the LuaValue integer type values
  See Also:
    `LuaValue.TNIL`, `LuaValue.TBOOLEAN`, `LuaValue.TNUMBER`, `LuaValue.TSTRING`, `LuaValue.TTABLE`, `LuaValue.TFUNCTION`, `LuaValue.TUSERDATA`, `LuaValue.TTHREAD`

### isnil

    public boolean isnil(int i)

  Tests if argument i is nil.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument is nil or does not exist, false otherwise
  See Also:
    `LuaValue.TNIL`

### isfunction

    public boolean isfunction(int i)

  Tests if argument i is a function.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists and is a function or closure, false otherwise
  See Also:
    `LuaValue.TFUNCTION`

### isnumber

    public boolean isnumber(int i)

  Tests if argument i is a number. Since anywhere a number is required, a string can be used that is a number, this will return true for both numbers and strings that can be interpreted as numbers.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists and is a number or string that can be interpreted as a number, false otherwise
  See Also:
    `LuaValue.TNUMBER`, `LuaValue.TSTRING`

### isstring

    public boolean isstring(int i)

  Tests if argument i is a string. Since all lua numbers can be used where strings are used, this will return true for both strings and numbers.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists and is a string or number, false otherwise
  See Also:
    `LuaValue.TNUMBER`, `LuaValue.TSTRING`

### istable

    public boolean istable(int i)

  Tests if argument i is a table.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists and is a lua table, false otherwise
  See Also:
    `LuaValue.TTABLE`

### isthread

    public boolean isthread(int i)

  Tests if argument i is a thread.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists and is a lua thread, false otherwise
  See Also:
    `LuaValue.TTHREAD`

### isuserdata

    public boolean isuserdata(int i)

  Tests if argument i is a userdata.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists and is a userdata, false otherwise
  See Also:
    `LuaValue.TUSERDATA`

### isvalue

    public boolean isvalue(int i)

  Tests if a value exists at argument i.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if the argument exists, false otherwise

### optboolean

    public boolean optboolean(int i,
                              boolean defval)

  Return argument i as a boolean value, `defval` if nil, or throw a LuaError if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if argument i is boolean true, false if it is false, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a lua boolean

### optclosure

    public LuaClosure optclosure(int i,
                                 LuaClosure defval)

  Return argument i as a closure, `defval` if nil, or throw a LuaError if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaClosure if argument i is a closure, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a lua closure

### optdouble

    public double optdouble(int i,
                            double defval)

  Return argument i as a double, `defval` if nil, or throw a LuaError if it cannot be converted to one.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    java double value if argument i is a number or string that converts to a number, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a number

### optfunction

    public LuaFunction optfunction(int i,
                                   LuaFunction defval)

  Return argument i as a function, `defval` if nil, or throw a LuaError if an incompatible type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaValue that can be called if argument i is lua function or closure, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a lua function or closure

### optint

    public int optint(int i,
                      int defval)

  Return argument i as a java int value, discarding any fractional part, `defval` if nil, or throw a LuaError if not a number.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    int value with fraction discarded and truncated if necessary if argument i is number, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a number

### optinteger

    public LuaInteger optinteger(int i,
                                 LuaInteger defval)

  Return argument i as a java int value, `defval` if nil, or throw a LuaError if not a number or is not representable by a java int.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaInteger value that fits in a java int without rounding, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument cannot be represented by a java int value

### optlong

    public long optlong(int i,
                        long defval)

  Return argument i as a java long value, discarding any fractional part, `defval` if nil, or throw a LuaError if not a number.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    long value with fraction discarded and truncated if necessary if argument i is number, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a number

### optnumber

    public LuaNumber optnumber(int i,
                               LuaNumber defval)

  Return argument i as a LuaNumber, `defval` if nil, or throw a LuaError if not a number or string that can be converted to a number.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument, or defval if not supplied or nil
  Returns:
    LuaNumber if argument i is number or can be converted to a number
  Throws:
    `LuaError` - if the argument is not a number

### optjstring

    public java.lang.String optjstring(int i,
                                       java.lang.String defval)

  Return argument i as a java String if a string or number, `defval` if nil, or throw a LuaError if any other type

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    String value if argument i is a string or number, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a string or number

### optstring

    public LuaString optstring(int i,
                               LuaString defval)

  Return argument i as a LuaString if a string or number, `defval` if nil, or throw a LuaError if any other type

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaString value if argument i is a string or number, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a string or number

### opttable

    public LuaTable opttable(int i,
                             LuaTable defval)

  Return argument i as a LuaTable if a lua table, `defval` if nil, or throw a LuaError if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaTable value if a table, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a lua table

### optthread

    public LuaThread optthread(int i,
                               LuaThread defval)

  Return argument i as a LuaThread if a lua thread, `defval` if nil, or throw a LuaError if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaThread value if a thread, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a lua thread

### optuserdata

    public java.lang.Object optuserdata(int i,
                                        java.lang.Object defval)

  Return argument i as a java Object if a userdata, `defval` if nil, or throw a LuaError if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    java Object value if argument i is a userdata, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a userdata

### optuserdata

    public java.lang.Object optuserdata(int i,
                                        java.lang.Class c,
                                        java.lang.Object defval)

  Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, `defval` if nil, or throw a LuaError if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
    `c` - the class to which the userdata instance must be assignable
  Returns:
    java Object value if argument i is a userdata whose instance Class c or a subclass, or defval if not supplied or nil
  Throws:
    `LuaError` - if the argument is not a userdata or from whose instance c is not assignable

### optvalue

    public LuaValue optvalue(int i,
                             LuaValue defval)

  Return argument i as a LuaValue if it exists, or `defval`.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaValue value if the argument exists, defval if not
  Throws:
    `LuaError` - if the argument does not exist.

### checkboolean

    public boolean checkboolean(int i)

  Return argument i as a boolean value, or throw an error if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if argument i is boolean true, false if it is false
  Throws:
    `LuaError` - if the argument is not a lua boolean

### checkclosure

    public LuaClosure checkclosure(int i)

  Return argument i as a closure, or throw an error if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaClosure if argument i is a closure.
  Throws:
    `LuaError` - if the argument is not a lua closure

### checkdouble

    public double checkdouble(int i)

  Return argument i as a double, or throw an error if it cannot be converted to one.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    java double value if argument i is a number or string that converts to a number
  Throws:
    `LuaError` - if the argument is not a number

### checkfunction

    public LuaFunction checkfunction(int i)

  Return argument i as a function, or throw an error if an incompatible type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaValue that can be called if argument i is lua function or closure
  Throws:
    `LuaError` - if the argument is not a lua function or closure

### checkint

    public int checkint(int i)

  Return argument i as a java int value, discarding any fractional part, or throw an error if not a number.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    int value with fraction discarded and truncated if necessary if argument i is number
  Throws:
    `LuaError` - if the argument is not a number

### checkinteger

    public LuaInteger checkinteger(int i)

  Return argument i as a java int value, or throw an error if not a number or is not representable by a java int.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaInteger value that fits in a java int without rounding
  Throws:
    `LuaError` - if the argument cannot be represented by a java int value

### checklong

    public long checklong(int i)

  Return argument i as a java long value, discarding any fractional part, or throw an error if not a number.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    long value with fraction discarded and truncated if necessary if argument i is number
  Throws:
    `LuaError` - if the argument is not a number

### checknumber

    public LuaNumber checknumber(int i)

  Return argument i as a LuaNumber, or throw an error if not a number or string that can be converted to a number.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaNumber if argument i is number or can be converted to a number
  Throws:
    `LuaError` - if the argument is not a number

### checkjstring

    public java.lang.String checkjstring(int i)

  Return argument i as a java String if a string or number, or throw an error if any other type

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    String value if argument i is a string or number
  Throws:
    `LuaError` - if the argument is not a string or number

### checkstring

    public LuaString checkstring(int i)

  Return argument i as a LuaString if a string or number, or throw an error if any other type

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaString value if argument i is a string or number
  Throws:
    `LuaError` - if the argument is not a string or number

### checktable

    public LuaTable checktable(int i)

  Return argument i as a LuaTable if a lua table, or throw an error if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaTable value if a table
  Throws:
    `LuaError` - if the argument is not a lua table

### checkthread

    public LuaThread checkthread(int i)

  Return argument i as a LuaThread if a lua thread, or throw an error if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaThread value if a thread
  Throws:
    `LuaError` - if the argument is not a lua thread

### checkuserdata

    public java.lang.Object checkuserdata(int i)

  Return argument i as a java Object if a userdata, or throw an error if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    java Object value if argument i is a userdata
  Throws:
    `LuaError` - if the argument is not a userdata

### checkuserdata

    public java.lang.Object checkuserdata(int i,
                                          java.lang.Class c)

  Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, or throw an error if any other type.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
    `c` - the class to which the userdata instance must be assignable
  Returns:
    java Object value if argument i is a userdata whose instance Class c or a subclass
  Throws:
    `LuaError` - if the argument is not a userdata or from whose instance c is not assignable

### checkvalue

    public LuaValue checkvalue(int i)

  Return argument i as a LuaValue if it exists, or throw an error.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaValue value if the argument exists
  Throws:
    `LuaError` - if the argument does not exist.

### checknotnil

    public LuaValue checknotnil(int i)

  Return argument i as a LuaValue if it is not nil, or throw an error if it is nil.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    LuaValue value if the argument is not nil
  Throws:
    `LuaError` - if the argument doesn't exist or evaluates to nil.

### argcheck

    public void argcheck(boolean test,
                         int i,
                         java.lang.String msg)

  Performs test on argument i as a LuaValue when a user-supplied assertion passes, or throw an error. Returns normally if the value of `test` is `true`, otherwise throws and argument error with the supplied message, `msg`.

  Parameters:
    `test` - user supplied assertion to test against
    `i` - the index to report in any error message
    `msg` - the error message to use when the test fails
  Throws:
    `LuaError` - if the the value of `test` is `false`

### isnoneornil

    public boolean isnoneornil(int i)

  Return true if there is no argument or nil at argument i.

  Parameters:
    `i` - the index of the argument to test, 1 is the first argument
  Returns:
    true if argument i contains either no argument or nil

### toboolean

    public boolean toboolean(int i)

  Convert argument `i` to java boolean based on lua rules for boolean evaluation.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    `false` if argument i is nil or false, otherwise `true`

### tobyte

    public byte tobyte(int i)

  Return argument i as a java byte value, discarding any fractional part and truncating, or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    byte value with fraction discarded and truncated if necessary if argument i is number, otherwise 0

### tochar

    public char tochar(int i)

  Return argument i as a java char value, discarding any fractional part and truncating, or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    char value with fraction discarded and truncated if necessary if argument i is number, otherwise 0

### todouble

    public double todouble(int i)

  Return argument i as a java double value or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    double value if argument i is number, otherwise 0

### tofloat

    public float tofloat(int i)

  Return argument i as a java float value, discarding excess fractional part and truncating, or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    float value with excess fraction discarded and truncated if necessary if argument i is number, otherwise 0

### toint

    public int toint(int i)

  Return argument i as a java int value, discarding any fractional part and truncating, or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    int value with fraction discarded and truncated if necessary if argument i is number, otherwise 0

### tolong

    public long tolong(int i)

  Return argument i as a java long value, discarding any fractional part and truncating, or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    long value with fraction discarded and truncated if necessary if argument i is number, otherwise 0

### tojstring

    public java.lang.String tojstring(int i)

  Return argument i as a java String based on the type of the argument.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    String value representing the type

### toshort

    public short toshort(int i)

  Return argument i as a java short value, discarding any fractional part and truncating, or 0 if not a number.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    short value with fraction discarded and truncated if necessary if argument i is number, otherwise 0

### touserdata

    public java.lang.Object touserdata(int i)

  Return argument i as a java Object if a userdata, or null.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
  Returns:
    java Object value if argument i is a userdata, otherwise null

### touserdata

    public java.lang.Object touserdata(int i,
                                       java.lang.Class c)

  Return argument i as a java Object if it is a userdata whose instance Class c or a subclass, or null.

  Parameters:
    `i` - the index of the argument to convert, 1 is the first argument
    `c` - the class to which the userdata instance must be assignable
  Returns:
    java Object value if argument i is a userdata whose instance Class c or a subclass, otherwise null

### tojstring

    public java.lang.String tojstring()

  Convert the list of varargs values to a human readable java String.

  Returns:
    String value in human readable form such as {1,2}.

### toString

    public java.lang.String toString()

  Convert the value or values to a java String using Varargs.tojstring()

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    String value in human readable form.
  See Also:
    `tojstring()`

### subargs

    public abstract Varargs subargs(int start)

  Create a `Varargs` instance containing arguments starting at index `start`

  Parameters:
    `start` - the index from which to include arguments, where 1 is the first argument.
  Returns:
    Varargs containing argument { start, start+1, ... , narg-start-1 }

Copyright © 2007-2015 Luaj.org. All Rights Reserved.