blob: 0c257e01b9920d0a7c9566ce6e742228095d5bb8 [file] [log] [blame] [raw]
package li.cil.oc.api.network.environment;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* This annotation can be used for methods in an {@link Environment} to mark
* them for exposure to Lua.
* <p/>
* Any method exposed like this can be enumerated and called from a computer
* that can see the node of the environment.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LuaCallback {
/**
* The name under which to make the callback available in Lua.
*
* @return the name of the function.
*/
String value() default "";
/**
* Whether this function may be called asynchronously, i.e. directly from
* the computer's executor thread.
* <p/>
* You will have to ensure anything your callback does is thread safe when
* setting this to <tt>true</tt>. Use this for minor lookups, for example.
* This is mainly intended to allow functions to perform faster than when
* called synchronously (where the call takes at least one server tick).
*/
boolean asynchronous() default false;
}