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


C# ILuaState.L_OpenLibs方法代码示例

本文整理汇总了C#中ILuaState.L_OpenLibs方法的典型用法代码示例。如果您正苦于以下问题:C# ILuaState.L_OpenLibs方法的具体用法?C# ILuaState.L_OpenLibs怎么用?C# ILuaState.L_OpenLibs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILuaState的用法示例。


在下文中一共展示了ILuaState.L_OpenLibs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Awake

	void Awake() {
		Debug.Log("LuaScriptController Awake");

		if( Lua == null )
		{
			Lua = LuaAPI.NewState();
			Lua.L_OpenLibs();

			var status = Lua.L_DoFile( LuaScriptFile );
			if( status != ThreadStatus.LUA_OK )
			{
				throw new Exception( Lua.ToString(-1) );
			}

			if( ! Lua.IsTable(-1) )
			{
				throw new Exception(
					"framework main's return value is not a table" );
			}

			AwakeRef 		= StoreMethod( "awake" );
			StartRef 		= StoreMethod( "start" );
			UpdateRef 		= StoreMethod( "update" );
			LateUpdateRef 	= StoreMethod( "late_update" );
			FixedUpdateRef 	= StoreMethod( "fixed_update" );

			Lua.Pop(1);
			Debug.Log("Lua Init Done");
		}

		CallMethod( AwakeRef );
	}
开发者ID:huxia,项目名称:UniLua,代码行数:32,代码来源:LuaScriptController.cs

示例2: LuaContex

    public LuaContex(PfnLog pfnLog,ILuaState pLua)
    {
        _pfnLog = pfnLog;

        _lua = pLua;

        if (_lua == null)
        {
            //_lua = LuaAPI.NewState(IntPtr.Zero);
            _lua.L_OpenLibs();
        }

        AddGlobalFunction("pcall", Lua_pcall);

        AddGlobalFunction("print", Lua_Print);
    
        AddGlobalFunction("warn", Lua_Warn);

        AddGlobalFunction("dofile", Lua_DoFile);

        AddGlobalFunction("_useutf8", Lua_UseUtf8);

        AddGlobalFunction("_ParseInteger", Lua_ParseInteger);

        AddGlobalFunction("_floatAccuracy", Lua_FloatAccuracy);

        AddGlobalFunction("GetTime", Lua_GetTime);

        AddGlobalFunction("GetTimeInfo", Lua_GetTimeInfo);

        AddGlobalFunction("loadstring", Lua_loadstring);

        for (int i = 0; i < _callparms.Length; ++i)
        {
            _callparms[i] = new mtype();
        }

        //UniLua.Tools.ULDebug.Log = WriteInfo;
        //UniLua.Tools.ULDebug.LogError = WriteError;
	}
开发者ID:cedar-x,项目名称:unilua_story,代码行数:40,代码来源:LuaContex.cs

示例3: Awake

	void Awake() {
		Debug.Log("LuaScriptController Awake");

		if( Lua == null )
		{
			Lua = LuaAPI.NewState();
			Lua.L_OpenLibs();

			var status = Lua.L_DoFile( LuaScriptFile );
			if( status != ThreadStatus.LUA_OK )
			{
				throw new Exception( Lua.ToString(-1) );
			}

			if( ! Lua.IsTable(-1) )
			{
				throw new Exception(
					"framework main's return value is not a table" );
			}

			AwakeRef 		= StoreMethod( "awake" );
			StartRef 		= StoreMethod( "start" );
			UpdateRef 		= StoreMethod( "update" );
			LateUpdateRef 	= StoreMethod( "late_update" );
			FixedUpdateRef 	= StoreMethod( "fixed_update" );

			Lua.Pop(1);
			Debug.Log("Lua Init Done");
		}
        Lua.GetGlobal("xxsmain");
        if (Lua.PCall(0, 0, 0) != ThreadStatus.LUA_OK)
        {
            Debug.LogWarning("Call global function xxsmain failed:" + Lua.ToString(-1));
            Lua.Pop(1);
        }
        Debug.Log("dofile main...........");
		CallMethod( AwakeRef );
	}
开发者ID:cedar-x,项目名称:unilua_story,代码行数:38,代码来源:LuaScriptController.cs

示例4: Start

 void Start () {
     Lua = LuaAPI.NewState();
     Lua.L_OpenLibs();
     var status = Lua.L_DoString(luastr);
     Debug.Log(status);
 }
开发者ID:heweitykc,项目名称:loadertest,代码行数:6,代码来源:SimpleDemo.cs

示例5: InitLua

 private bool InitLua()
 {
     if (_lua == null)
     {
         _lua = LuaAPI.NewState();
         _lua.L_OpenLibs();
     }
     RefLua();
     return true;
 }
开发者ID:cedar-x,项目名称:unilua_story,代码行数:10,代码来源:StoryGame.cs


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