Baleine's recent timeline updates
Baleine

Baleine

V2EX member #380236, joined on 2019-01-26 01:40:18 +08:00
Per Baleine's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
Baleine's recent replies
正好也在用 luaj 在 Minecraft 里做类似的事情。

这边的解决方案是给每一个玩家一个对应的数据实例,并在调用 LuaValue::call 之前将这个实例作为 lua 脚本的变量传递进去。

类似于:
Globals globals = JsePlatform.standardGlobals();
LuaValue luaPlayer = CoerceJavaToLua.coerce(dataInstance);
globals.set("data", luaPlayer);

其中 dataInstance 是对应的数据实例,"data"则是变量名。

在 lua 中可以直接调用实例中的成员方法,所以其实 API 也可以用类似的操作传递进去。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2414 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 02:19 · PVG 10:19 · LAX 19:19 · JFK 22:19
♥ Do have faith in what you're doing.