AddSearchPath() public méthode

public AddSearchPath ( string path ) : void
path string
Résultat void
Exemple #1
0
	void Start () 
    {        
        LuaState lua = new LuaState();
        lua.Start();        
        
        string fullPath = Application.dataPath + "/ToLua/Examples/02_ScriptsFromFile";
        lua.AddSearchPath(fullPath);         
        lua.DoFile("ScriptsFromFile.lua");        
        //lua.DoString("require 'ScriptsFromFile'");                             
        //lua.Require("ScriptsFromFile");                

        lua.Dispose();
	}
 void Start()
 {
     #if UNITY_5
     Application.logMessageReceived += Log;
     #else
     Application.RegisterLogCallback(Log);
     #endif
     lua = new LuaState();
     lua.Start();
     //如果移动了ToLua目录,自己手动修复吧,只是例子就不做配置了
     string fullPath = Application.dataPath + "\\ToLua/Examples/02_ScriptsFromFile";
     lua.AddSearchPath(fullPath);
 }
 void Start()
 {
     #if UNITY_5
     Application.logMessageReceived += Log;
     #else
     Application.RegisterLogCallback(Log);
     #endif
     lua = new LuaState();
     lua.Start();
     //移动了ToLua路径,自己手动修复吧,只是例子就不做配置了
     Debug.Log("Application.dataPath = " + Application.dataPath);
     string fullPath = Application.dataPath + "/LuaFramework/ToLua/Examples/02_ScriptsFromFile";
     lua.AddSearchPath(fullPath);
 }
Exemple #4
0
    public static void Init(string mainScript)
    {
        if (string.IsNullOrEmpty(mainScript))
            throw new System.NullReferenceException("Can't found the main script.");

        State = new LuaState();

        // 增加搜索路径
        for (int i = 0; i < globalSearchPaths.Count; ++i)
            State.AddSearchPath(globalSearchPaths[i]);

        State.OpenLibs(LuaDLL.luaopen_pb);
        LuaBinder.Bind(State);
        State.Start();
        State.DoFile(mainScript);
    }