当前位置: 首页>>代码示例>>Java>>正文


Java LuaUserdata类代码示例

本文整理汇总了Java中org.luaj.vm2.LuaUserdata的典型用法代码示例。如果您正苦于以下问题:Java LuaUserdata类的具体用法?Java LuaUserdata怎么用?Java LuaUserdata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LuaUserdata类属于org.luaj.vm2包,在下文中一共展示了LuaUserdata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeInheritanceMap

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
/**
 * Lua Closure for MappingFactory.makeInheritanceMap(jarFile, mappingArg)
 * @param jarFile Jar file to make the inheritance map for.
 * @param mappingArg Mappings to make the inheritance map for. The inheritance map will only contains symbols also contained in this mapping.
 * @return
 */
private static final LuaValue makeInheritanceMap(String jarFile, SrgMapping mapping)
{
	File inputJar = new File(jarFile);

	try
	{
		Jar inJar = Jar.init(inputJar);
		
		SrgInheritanceMap inheritMap = new SrgInheritanceMap(new JarProvider(inJar), mapping);
		
		return new LuaUserdata(inheritMap, SrgInheritanceMapMeta.getMetaTable());
	}
	catch (Exception e)
	{
		throw new LuaError(e);
	}
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:24,代码来源:MappingLib.java

示例2: loadInheritanceMap

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
/**
 * Lua Closure for MappingFactory.loadInheritanceMap(filename[, filename[, filename[, ...]]])
 * @param filenames The inheritance maps to load.
 * @return
 */
private static final LuaValue loadInheritanceMap(Varargs filenames)
{
	SrgInheritanceMap inheritance = new SrgInheritanceMap();
	
	int args = filenames.narg() + 1;
	for (int i = 1; i != args; ++i)
	{
		String filename = filenames.arg(i).checkjstring();

		File file = new File(filename);
		if (!file.exists())
			throw new LuaError("File " + filename + " does not exist.");

		try
		{
			inheritance.loadMapping(file);
		}
		catch (Exception e)
		{
			throw new LuaError(e);
		}
	}
	
	return new LuaUserdata(inheritance, SrgInheritanceMapMeta.getMetaTable());
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:31,代码来源:MappingLib.java

示例3: invoke

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
    Object o = args.checkuserdata(1);
    LuaValue v = args.checkvalue(2);
    LuaUserdata u = (LuaUserdata) args.arg1();
    u.m_instance = v.checkuserdata();
    u.m_metatable = v.getmetatable();
    return NONE;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:9,代码来源:DebugLib.java

示例4: invoke

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
	Object o = args.checkuserdata(1);
	LuaValue v = args.checkvalue(2);
	LuaUserdata u = (LuaUserdata) args.arg1();
	u.m_instance = v.checkuserdata();
	u.m_metatable = v.getmetatable();
	return NONE;
}
 
开发者ID:hsllany,项目名称:HtmlNative,代码行数:9,代码来源:DebugLib.java

示例5: invoke

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
@Override
public Varargs invoke(Varargs arguments) {
	BlocksItems.load();
	if (arguments.isstring(1)) {
		LuaUserdata u = blocksItems.blockUserdata.get(arguments.checkjstring(1));
		return u != null ? u : NIL;
	} else {
		return BlocksItems.blockTable;
	}
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:11,代码来源:LuaMappingCubes.java

示例6: call

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
@Override
public LuaValue call(LuaValue gb1, LuaValue gb2, LuaValue gb3) {
	int x = gb1.checkint();
	int y = gb2.checkint();
	int z = gb3.checkint();
	return new LuaUserdata(world.getBlock(x, y, z));
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:8,代码来源:LuaMappingWorld.java

示例7: invoke

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
@Override
public Varargs invoke(Varargs args) {
  BlocksItems.load();
  if (args.isstring(1)) {
    LuaUserdata u = BlocksItems.blockUserdata.get(args.checkjstring(1));
    return u != null ? u : NIL;
  } else {
    return BlocksItems.blockTable;
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:11,代码来源:LuaMappingCubes.java

示例8: call

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
@Override
public LuaValue call(LuaValue arg1, LuaValue arg2, LuaValue arg3) {
  int x = arg1.checkint();
  int y = arg2.checkint();
  int z = arg3.checkint();
  return new LuaUserdata(world.getBlock(x, y, z));
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:8,代码来源:LuaMappingWorld.java

示例9: invoke

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
public Varargs invoke(Varargs args) {
	Object o = args.checkuserdata(1);
	LuaValue v = args.checkvalue(2);
	LuaUserdata u = (LuaUserdata)args.arg1();
	u.m_instance = v.checkuserdata();
	u.m_metatable = v.getmetatable();
	return NONE;
}
 
开发者ID:Cephrus,项目名称:Elite-Armageddon,代码行数:9,代码来源:DebugLib.java

示例10: entries

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
private static LuaValue entries(ZipFile instance)
{		
	Enumeration<? extends ZipEntry> files = instance.entries();
	LuaTable fileTable = new LuaTable();		
	int i = 1;
	while (files.hasMoreElements())
	{
		ZipEntry entry = files.nextElement();
		
		fileTable.set(i++, new LuaUserdata(entry, ZipEntryMeta.getMetaTable()));
	}
	
	return fileTable;
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:15,代码来源:ZipFileMeta.java

示例11: getEntry

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
private static LuaValue getEntry(ZipFile instance, String path)
{		
	ZipEntry entry = instance.getEntry(path);
	
	if (entry == null)
		return LuaValue.NONE;
	else
		return new LuaUserdata(entry, ZipEntryMeta.getMetaTable());
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:10,代码来源:ZipFileMeta.java

示例12: open

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
private static LuaValue open(String path)
{
	try
	{
		return new LuaUserdata(new ZipFile(new File(path)), ZipFileMeta.getMetaTable());
	}
	catch (Exception e)
	{
		throw new LuaError(e);
	}
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:12,代码来源:ZipLib.java

示例13: loadSrgMapping

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
/**
 * Lua Closure for MappingFactory.loadSrg(filename, ...).
 * Loads all specified srg files into a single srg mapping.
 * 
 * @param filenames The filenames to load
 * @return The SrgMapping (as UserData)
 */
private static LuaValue loadSrgMapping(Varargs filenames)
{
	
	SrgMapping mapping = new SrgMapping();
	
	int args = filenames.narg() + 1;
	for (int i = 1; i != args; ++i)
	{
		String filename = filenames.arg(i).checkjstring();

		File file = new File(filename);
		if (!file.exists())
			throw new LuaError("File " + filename + " does not exist.");

		try
		{
			mapping.loadMapping(file);
		}
		catch (Exception e)
		{
			throw new LuaError(e);
		}
	}
	
	return new LuaUserdata(mapping, SrgMappingMeta.getMetaTable());
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:34,代码来源:MappingLib.java

示例14: loadMCPMapping

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
/**
 * Lua Closure for MappingFactory.loadMCP(fieldsFile, methodsFile, packagesFile).
 * Loads the specified MCP csv files into a mapping. 
 * @param fieldsFile The fields.csv file, or nil to ignore field mappings.
 * @param methodsFile The methods.csv file, or nil to ignore method mappings.
 * @param packagesFile The packages.csv file, or nil to ignore package mappings.
 * @return The MinecraftCodersPackMapping (as UserData)
 */
private static final LuaValue loadMCPMapping(LuaValue fieldsFile, LuaValue methodsFile, LuaValue packagesFile)
{
	File fields = fieldsFile.isnil() ? null : new File(fieldsFile.checkjstring());
	File methods = methodsFile.isnil() ? null : new File(methodsFile.checkjstring());
	File packages = packagesFile.isnil() ? null : new File(packagesFile.checkjstring());
	
	if (fields != null && fields.exists() == false)
		throw new LuaError("File " + fields.getAbsolutePath() + " does not exist.");
	
	if (methods != null && methods.exists() == false)
		throw new LuaError("File " + fields.getAbsolutePath() + " does not exist.");
	
	if (packages != null && packages.exists() == false)
		throw new LuaError("File " + fields.getAbsolutePath() + " does not exist.");
	

	try
	{
		MinecraftCodersPackMapping mapping = new MinecraftCodersPackMapping(fields, methods, packages);
		return new LuaUserdata(mapping);
	}
	catch (Exception e)
	{
		throw new LuaError(e);
	}
}
 
开发者ID:Lrns123,项目名称:SrgUtility,代码行数:35,代码来源:MappingLib.java

示例15: call

import org.luaj.vm2.LuaUserdata; //导入依赖的package包/类
public LuaValue call(LuaValue u) {
	return LuaValue.valueOf(Array.getLength(((LuaUserdata)u).m_instance));
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:4,代码来源:JavaArray.java


注:本文中的org.luaj.vm2.LuaUserdata类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。