-
Notifications
You must be signed in to change notification settings - Fork 6
Native access
Unlike in most JVMs (OpenJDK's JVM, Oracle HotSpot, etc.), Lukyt native code is in Lua. Any Java program can use Runtime.getRuntime().loadLibrary
to load lua files and not C (or any C-compatible language) dynamic libraries. The Lua file is then simply executed with dofile
For Lukyt to know what function to call when a native method is requested, it must of a standard name.
Standard lukyt native lua functions name is: package_class_methodName
, where package
has all /
or .
replaced by _
. Example: org_package_TeaMachine_getTea
.
The name doesn't include descriptors as the function can check the method argument (see below) to check for the descriptor.
A native function 4 arguments, respectively: the Class of the method, the Method itself, the current Thread and the arguments to the method.
The 4th argument (arguments to the method) is an indexed table containing the arguments as Java Objects.