Skip to content

Aside - Type Mapping Reference

Lua TypeJava Type
nilnull
numberbyte, short, int, long, float, double, Byte, Short, Int, Long, Float, Double [1]
booleanboolean, Boolean
stringString
functioninstance [2]
tableSee Source code[3]
userdatainstance, Class, EClass [4]

  1. If a number greater than the max size of the Java type is provided, it overflows, wrapping around. (ex. if passing 256 where a byte is expected, the resulting byte will be 0) ↩︎

  2. When going from Lua to Java, converted to an instance of a functional interface (java interface with only one method), where applicable. see Callback Methods ↩︎

  3. When going from Java to Lua, converted only if the java method's return value is annotated with @CoerceToNative. When going from Lua to Java, converted unconditionally. ↩︎

  4. Java classes and objects are wrapped as userdata. Additionally, where a Class or EClass are expected, a userdata passed directly from require can be used. ↩︎