本文整理汇总了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 );
}
示例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;
}
示例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 );
}
示例4: Start
void Start () {
Lua = LuaAPI.NewState();
Lua.L_OpenLibs();
var status = Lua.L_DoString(luastr);
Debug.Log(status);
}
示例5: InitLua
private bool InitLua()
{
if (_lua == null)
{
_lua = LuaAPI.NewState();
_lua.L_OpenLibs();
}
RefLua();
return true;
}