org.luaj.vm2.Globals.loadPrototype()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中org.luaj.vm2.Globals.loadPrototype()方法的一些代码示例,展示了Globals.loadPrototype()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Globals.loadPrototype()方法的具体详情如下:
包路径:org.luaj.vm2.Globals
类名称:Globals
方法名:loadPrototype

Globals.loadPrototype介绍

[英]Load lua source or lua binary from an input stream into a Prototype. The InputStream is either a binary lua chunk starting with the lua binary chunk signature, or a text input file. If it is a text input file, it is interpreted as a UTF-8 byte sequence.
[中]将lua源或lua二进制文件从输入流加载到原型中。InputStream要么是以lua二进制块签名开始的二进制lua块,要么是文本输入文件。如果是文本输入文件,则将其解释为UTF-8字节序列。

代码示例

代码示例来源:origin: M66B/XPrivacyLua

/** Load the content form an input stream as a binary chunk or text file. 
 * @param is InputStream containing a lua script or compiled lua"
 * @param chunkname Name that will be used within the chunk as the source.
 * @param mode String containing 'b' or 't' or both to control loading as binary or text or either.
 * @param environment LuaTable to be used as the environment for the loaded function.
 * */
public LuaValue load(InputStream is, String chunkname, String mode, LuaValue environment) {
  try {
    Prototype p = loadPrototype(is, chunkname, mode);
    return loader.load(p, chunkname, environment);
  } catch (LuaError l) {
    throw l;
  } catch (Exception e) {
    return error("load "+chunkname+": "+e);
  }
}

代码示例来源:origin: hsllany/HtmlNative

/** Load the content form an input stream as a binary chunk or text file. 
 * @param is InputStream containing a lua script or compiled lua"
 * @param chunkname Name that will be used within the chunk as the source.
 * @param mode String containing 'b' or 't' or both to control loading as binary or text or either.
 * @param environment LuaTable to be used as the environment for the loaded function.
 * */
public LuaValue load(InputStream is, String chunkname, String mode, LuaValue environment) {
  try {
    Prototype p = loadPrototype(is, chunkname, mode);
    return loader.load(p, chunkname, environment);
  } catch (LuaError l) {
    throw l;
  } catch (Exception e) {
    return error("load "+chunkname+": "+e);
  }
}

代码示例来源:origin: Tencent/RapidView

binary = mGlobals.loadPrototype(streamFile, name, "b");

代码示例来源:origin: Tencent/RapidView

binary = global.loadPrototype(streamFile, name, "b");

相关文章