{"id":19215862,"url":"https://github.com/movingblocks/jnlua","last_synced_at":"2025-05-12T23:29:33.224Z","repository":{"id":52626109,"uuid":"134069518","full_name":"MovingBlocks/JNLua","owner":"MovingBlocks","description":"Fork of JNI-based Lua scripting language integration for the JVM","archived":false,"fork":false,"pushed_at":"2023-08-21T16:42:40.000Z","size":662,"stargazers_count":19,"open_issues_count":3,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-20T19:38:08.124Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MovingBlocks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-19T14:32:12.000Z","updated_at":"2024-12-31T02:07:25.000Z","dependencies_parsed_at":"2025-04-20T19:36:04.097Z","dependency_job_id":"b9840614-9c9b-4508-9514-17f0c33ae00c","html_url":"https://github.com/MovingBlocks/JNLua","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MovingBlocks%2FJNLua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MovingBlocks%2FJNLua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MovingBlocks%2FJNLua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MovingBlocks%2FJNLua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MovingBlocks","download_url":"https://codeload.github.com/MovingBlocks/JNLua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253839752,"owners_count":21972366,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T14:15:06.311Z","updated_at":"2025-05-12T23:29:33.198Z","avatar_url":"https://github.com/MovingBlocks.png","language":"Java","readme":"# JNLua (Terasology version)\n\nJNLua (Java Native Lua) is a bridge between the native Lua virtual machine and Java's, utilizing JNI to communicate between the C Lua code and JVM \ncode.\n\n## Features\n\nFrom [the original website](https://code.google.com/p/jnlua/):\n\n- **Full Lua support with full Java type-safety.** JNLua provides the full functionality of Lua C API including large parts of the Lua Auxiliary \nLibrary. All Lua Standard Libraries are supported, including the coroutine functions. At the same time, JNLua maintains the type-safety of the Java \nVM by performing rigorous checks in its native library.\n- **Two-way integration.** With JNLua, you can access Java from Lua and Lua from Java. From Lua, JNLua provides full Java object access with \nintuitive syntax and the abilitiy to implement Java interfaces in Lua. From Java, JNLua provides full Lua access including the ability to implement \nLua functions in Java. The integration works transparently in both directions and on each end conforms to the common principles of the respective \nplatform.\n- **Dual bootstrapping.** JNLua can be started from both the Java and the Lua side. If started from the Java side, a Lua state is attached to the \ncalling Java virtual machine; if started from the Lua side, a Java virtual machine is attached to the calling Lua process.\n- **Extensive language bindings.** The bindings between Lua and Java are abstracted into the domains of *Java reflection* and *conversion*. The \n*default Java reflector* supports field, method and property access on Java classes and objects. For overloaded methods, it provides a dispatch \nlogic that mimics the behavior described in Java Language Specification. The *default converter* handles the bidirectional conversion of primitive \ntypes, such as numbers and strings. For complex types, it supports the bidirectional mapping of Lua tables to Java maps, lists and arrays. These \nmappings are generally implemented with proxy objects, that is, they work by *reference*. Both the Java reflector and converter can be specialized \nto fit custom needs.\n- **Java module.** The JNLua Java module provides a small but comprehensive set of Lua functions providing Java language support for Lua.\n- **Java VM module.** The Java VM module is a Lua module written in C that allows a Lua process to create a Java Virtual Machine and run Java code \nin that machine.\n- **Transparent error handling.** Java does error handling by exceptions; Lua uses mechanics such as `error()` and `pcall()`. JNLua ensures a \nseamless translation of error conditions between the two domains. Lua errors are reported as exceptions to Java. Java exceptions generate errors on \nthe Lua side.\n- **JSR 223: Scripting for the Java Platform provider.** JNLua includes a provider that conforms to the [JSR 223: Scripting for the Java \nPlatform](http://www.jcp.org/en/jsr/detail?id=223) specification. This allows the use of Lua as a scripting language for Java in a standardized \nway. The JSR 223 provider also supports the optional Compilable and Invocable interfaces.\n- **JNLua Console.** A simple console implemented in Java for experimenting with JNLua. \n\nAdditionally, the Terasology version provides the following:\n\n- **Support for [Eris](https://github.com/fnuecke/eris)**, a modified version of the Lua virtual machine with support for state serialization.\n- **Memory usage limiting** for additional sandboxing\n- **Simultaneous Lua 5.2 and Lua 5.3 support**\n\n## Building\n\nTo build the Java side of JNLua, a simple \"./gradlew build\" is sufficient.\n\nBuilding the natives is more involved. Generally, JNLua expects natives to be present with the following filenames:\n\nlibjnlua-[5.2,5.3]-[windows,linux]-[i686,amd64].[dll,so]\n\nTo build the natives on Linux you need:\n\n* a reasonably modern Linux distribution (tested with Debian Stretch),\n* MinGW-w64 (apt-get install mingw-w64),\n* 32-bit and 64-bit build environments (apt-get install build-essential gcc-multilib libc6-dev:i386)\n\nThen simply run `./build-natives-eris.sh` and with a little luck you now have shiny new natives compiled for Linux (and Windows).\n\nNote that during the script execution [Eris](https://github.com/fnuecke/eris) will be cloned into a subdir `eris`.\n\nOn Mac you need general development tools and `JAVA_HOME` set, to for instance `/Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home`\n\nDuring initial work on the natives script on Mac that was the only edit needed. Unsure if any additional steps are needed, some were already done.\n\nRun `./build-natives-eris_mac.sh` and the Mac OS specific natives should now be yours as well.\n\nIn both cases for the unit tests to work the resulting files must be copied into a `natives` subdir, which Gradle puts on the Java library path.\n\nFor instance on Mac make sure the directory exists then simply run `cp native-build/* natives` and a `./gradlew test` should pass all the tests.\n\nOur official build publishes both the JNLua jar and natives to the [MovingBlocks Artifactory](http://artifactory.terasology.org/artifactory/webapp/#/artifacts/browse/tree/General/libs-snapshot-local/org/terasology/jnlua) via `publishNatives.gradle` and some Jenkins magic.\n\nMac cloud builds are tricky so for the moment we're using a [Jenkins agent on Cervator's Macbook](http://jenkins.terasology.org/computer/MacBuilder/) that'll be connected manually when needed.\n\n## License\n\nJNLua is licensed under the MIT license which at the time of this writing is the same license as the one of Lua. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovingblocks%2Fjnlua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmovingblocks%2Fjnlua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovingblocks%2Fjnlua/lists"}