android luaj 回调,Getting Started with LuaJ

Luaj版本升级着重于适配Lua5.2.x环境,引入了bit32库和Globals对象以提升线程安全性。移除了不兼容的函数并增强了table操作。修复了内存泄漏和字符串解析的bug,提高了os.time()和os.date()的实现。此外,还增加了对Android和Applet的示例代码,支持自定义环境加载脚本,并优化了错误处理和垃圾回收。
摘要由CSDN通过智能技术生成

Convert internal and external API's to match lua 5.2.x environment changes

Add bit32 library

Add explicit Globals object to manage global state, especially to imrpove thread safety

Drop support for lua source to java surce (lua2java) in favor of direct java bytecode output (luajc)

Remove compatibility functions like table.getn(), table.maxn(), table.foreach(), and math.log10()

Add ability to create runnable jar file from lua script with sample build file build-app.xml

Supply environment as second argument to LibFunction when loading via require()

Fix bug 3597515 memory leak due to string caching by simplifying caching logic.

Fix bug 3565008 so that short substrings are backed by short arrays.

Fix bug 3495802 to return correct offset of substrings from string.find().

Add artifacts to Maven central repository.

Limit pluggable scripting to use compatible bindings and contexts, implement redirection.

Fix bug that didn't read package.path from environment.

Fix pluggable scripting engine lookup, simplify implementation, and add unit tests.

Coerce script engine eval() return values to Java.

Fix Lua to Java coercion directly on Java classes.

Fix Globals.load() to call the library with an empty modname and the globals as the environment.

Fix hash codes of double.

Fix bug in luajava overload resolution.

Fix luastring bug where parsing did not check for overflow.

Fix luastring bug where circular dependency randomly caused NullPointerException.

Major refactor of table implementation.

Improved behavior of next() (fixes issue #7).

Existing tables can now be made weak (fixes issue #16).

More compatible allocation of table entries in array vs. hash (fixes issue #8).

Fix os.time() to return a number of seconds instead of milliseconds.

Implement formatting with os.date(), and table argument for os.time().

LuaValue.checkfunction() now returns LuaFunction.

Refactor APIs related to compiling and loading scripts to provide methods on Globals.

Add API to compile from Readers as well as InputStreams.

Add optional -c encoding flag to lua, luac, and luajc tools to control source encoding.

Let errors thrown in debug hooks bubble up to the running coroutine.

Make error message handler function in xpcall per-thread instead of per-globals.

Establish "org.luaj.debug" and "org.luaj.luajc" system properties to configure scripting engine.

Add sample code for Android Application that uses luaj.

Add sample code for Applet that uses luaj.

Fix balanced match for empty string (fixes issue #23).

Pass user-supplied ScriptContext to script engine evaluation (fixes issue #21).

Autoflush and encode written bytes in script contexts (fixes issue #20).

Rename Globals.FINDER to Globals.finder.

Fix bug in Globals.UTF8Stream affecting loading from Readers (fixes issue #24).

Add buffered input for compiling and loading of scripts.

In CoerceJavaToLua.coerse(), coerce byte[] to LuaString (fixes issue #31).

In CoerceJavaToLua.coerse(), coerce LuaValue to same value (fixes issue #29).

Fix line number reporting in debug stack traces (fixes issue #30).

3.0.1Fix __len metatag processing for tables.

Add fallback to __lt when pocessing __le metatag.

Convert anonymous classes to inner classes (gradle build support).

Allow error() function to pass any lua object including non-strings.

Fix string backing ownership issue when compiling many scripts.

Make LuaC compile state explicit and improve factoring.

Add sample build.gradle file for Android example.

collectgarbage() now behaves same as collectgarbage("collect") (fixes issue #41).

Allow access to Java inner classes using lua field syntax (fixes issue #40).

List keyeq() and keyindex() methods as abstract on LuaTable.Entry (issue #37).

Fix return value for table.remove() and table.insert() (fixes issue #39)

Fix aliasing issue for some multiple assignments from varargs return values (fixes issue #38)

Let os.getenv() return System.getenv() values first for JSE, then fall back to properties (fixes issue #25)

Improve garbage collection of orphaned coroutines when yielding from debug hook functions (fixes issue #32).

LuaScriptEngineFactory.getScriptEngine() now returns new instance of LuaScriptEngine for each call.

Fix os.date("*t") to return hour in 24 hour format (fixes issue #45)

Add SampleSandboxed.java example code to illustrate sandboxing techniques in Java.

Add samplesandboxed.lua example code to illustrate sandboxing techniques in lua.

Add CollectingOrphanedCoroutines.java example code to show how to deal with orphaned lua threads.

Add LuajClassLoader.java and Launcher.java to simplify loading via custom class loader.

Add SampleUsingClassLoader.java example code to demonstrate loading using custom class loader.

Make shared string metatable an actual metatable.

Add sample code that illustrates techniques in creating sandboxed environments.

Add convenience methods to Global to load string scripts with custom environment.

Fix os.time() conversions for pm times.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值