custom require path - sonygod/luaxe-nlua GitHub Wiki

c# code

		env = new Lua();
        env.LoadCLRPackage();

        env["this"] = this; // Give the script access to the gameobject.
        env["transform"] = transform;
       	
        var path = Application.streamingAssetsPath + "/lua/?.lua";
	
        var ss = string.Format("package.path =';{0}'", path);

        //Debug.Log(ss);
        env.DoString(ss);

http://stackoverflow.com/questions/5761229/is-there-a-better-way-to-require-file-from-relative-path-in-lua/5761649#5761649


    env = new Lua();
    env.LoadCLRPackage();

    //设置lua脚本文件查找路径
    env["package.path"] = env["package.path"] + ";" + Application.persistentDataPath + "/lua/?.lua;";