コード例 #1
0
ファイル: Lua.cs プロジェクト: BackupTheBerlios/dotlua-svn
 /// <summary>
 /// Pushes our own error handler on top of the stack
 /// </summary>
 private void RegisterErrorHandler()
 {
     panic = new LuaCallbackFunction(LuaPanic);
     // Push it and store a value
     handler = Stack.Push(panic);
     NativeLua.lua_atpanic(lua, panic);
 }
コード例 #2
0
ファイル: Lua.cs プロジェクト: BackupTheBerlios/dotlua-svn
 /// <summary>
 /// Registers a callback function. Every callback function is being
 /// registered in the global namespace.
 /// </summary>
 /// <param name="name">Name of the function, as it should be available inside the Script</param>
 /// <param name="function">Application defined callback function</param>
 /// <remarks>To register a callback function in the given namespace, create a new
 /// variable holding a table. Then insert the callback function into this table to
 /// retrieve a new namespace.</remarks>
 public void Register(string name, LuaCallbackFunction function)
 {
     if (name == null)
     { // name must not be null
         throw new ArgumentNullException("name");
     }
     if (function == null)
     { // function must not be null
         throw new ArgumentNullException("function");
     }
     // That easy :-)
     Tables.Global.SetValue(name, function);
 }