Giter Club home page Giter Club logo

Comments (3)

ichenhe avatar ichenhe commented on August 25, 2024

抱歉回复晚了。
不是很懂你的意思,解析 Json 需要自行在 java 实现,然后留个接口返回给 lua。类型是个 table 就行。

from android-lua.

sd3970566 avatar sd3970566 commented on August 25, 2024

from android-lua.

ichenhe avatar ichenhe commented on August 25, 2024

关于 json

抱歉,现在没空接定制。不过可以给你一个提示:如果只是简单的 json (json格式已知),那么直接使用 java json 库 (moshi/gson/fastjson 等) 解析出 javabean 后再注入 Lua 表就行了。

如果是脏数据(json 格式未知),那么你需要使用相关库的底层API (对于 gson/fastjson 可以解析为中间层,对 moshi 需要使用流式 API),遍历出所具有的字段,然后再写入 Lua 表。这个情况比较麻烦。

如果你想在 Lua 上实现类似 java 的API (传入一个 class 然后自动返回解析后的实例),那么需要自己写一个中间层用于把 lua 和 java class 进行对应。

如果不想注入 Lua 表,也可以直接注入解析后的 java 对象,但是不建议,因为性能比较差。

关于安全

所有本地代码根本不存在安全的保证,无非是 java 层解密更容易破解,jni 层解密不容易破解罢了。你的需求大概实现流程是:java 传一个文件到 JNI,JNI 读取此文件,进行解密,然后直接传给 lua 执行,最后结果返回 java. 由于我对 Android Native API 不太熟悉,所以抱歉无法帮你实现。

from android-lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.