npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

com.azathrix.mini-panda

v1.0.3

Published

轻量级脚本语言,专为 Unity 设计

Readme


特性

  • 字节码编译执行,编译缓存
  • 变量、函数、Lambda、类、继承
  • 模块系统(import/export)
  • 异常处理(try/catch/finally)
  • C# 双向互操作
  • 调试支持(DAP 协议)

安装

方式一:Package Manager 添加 Scope(推荐)

  1. 打开 Edit > Project Settings > Package Manager
  2. Scoped Registries 中添加:
    • Name: Azathrix
    • URL: https://registry.npmjs.org
    • Scope(s): com.azathrix
  3. 点击 Save
  4. 打开 Window > Package Manager
  5. 切换到 My Registries
  6. 找到 MiniPanda 并安装

方式二:Git URL

  1. 打开 Window > Package Manager
  2. 点击 + > Add package from git URL...
  3. 输入:https://github.com/Azathrix/MiniPanda.git#latest

方式三:npm 命令

在项目的 Packages 目录下执行:

npm install com.azathrix.mini-panda

编辑器支持

推荐安装 MiniPanda VSCode 插件,提供语法高亮、代码补全、跳转定义、断点调试。

快速示例

基本使用

using Azathrix.MiniPanda;

var vm = new MiniPanda();
vm.Start();

// Run - 执行代码
vm.Run("var x = 10");
vm.Run("print(x * 2)");  // 输出: 20

// Eval - 求值表达式
var result = vm.Eval("x + 5");
Debug.Log(result.AsNumber());  // 15

vm.Shutdown();

注册 C# 函数

// 注册变量
vm.SetGlobal("playerHP", 100);
vm.SetGlobal("playerName", "Hero");

// 注册函数
vm.SetGlobal("heal", NativeFunction.Create((Value amount) => {
    var hp = vm.GetGlobal("playerHP").AsNumber();
    hp = Math.Min(hp + amount.AsNumber(), 100);
    vm.SetGlobal("playerHP", hp);
    return Value.FromNumber(hp);
}));

// 脚本中调用
vm.Run("heal(30)");

获取脚本值

// 获取全局变量
var hp = vm.GetGlobal("playerHP").AsNumber();
var name = vm.GetGlobal("playerName").AsString();

// 调用脚本函数
vm.Run("func damage(a, b) return a * b");
var result = vm.Call("damage", 10, 1.5);  // 15

// 带临时环境求值
var sum = vm.Eval("a + b + c", new { a = 1, b = 2, c = 3 });  // 6

脚本语法

// 变量与字符串插值
var name = "MiniPanda"
print("Hello {name}!")

// 函数与 Lambda
func add(a, b = 0) return a + b
var double = (x) => x * 2

// 类与继承
class Entity {
    Entity(name) { this.name = name }
}
class Player : Entity {
    Player(name, level) {
        super.Entity(name)
        this.level = level
    }
}

// 模块
import "utils" as u
export func helper() { }

性能

Unity 6000.3 测试结果:

| 操作 | 性能 | |------|------| | Eval 简单表达式 | 1.1μs | | Run 编译+执行 | 2μs | | 函数调用 | 3.1μs | | GetGlobal | 0.1μs | | SetGlobal | <0.1μs | | 循环 100000 次 | 76ms | | 递归 fib(20) | 30ms |

大部分操作零 GC 分配。

License

MIT