lua-users home
lua-l archive

Re: Getting Lua to print in Windows

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Not to be rude or anything, but why do all that?
someluastate.DoString( "print = luanet.System.Diagnostics.Debug.Write" );
(note, haven't verified, but should work just fine)
that's it.
Lythoner wrote:
You may try this. This may not be good approach, since I am newbie to Lua & .NET. This is to replace the print function in the Lua with the .NET. I am sure whether you need it for .NET or C++.
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using LuaInterface;
class LuaConsole
{
Lua _LuaVM = new Lua();
public void Initialize()
{
 System.Type type = GetType();
 MethodInfo mInfo = type.GetMethod("Print");
 _LuaVM.RegisterFunction("print", this, mInfo);
}
public void Print(string data) // capture the lua output
{
// Do Console Print or redirect to debug or log the message etc
}
}
Regards,
Krish
David Dunham wrote:
I've been doing most of our Lua development on Mac OS X, and Lua's print statement conveniently goes to the console. I figured the same would happen in Windows, at least when running under Visual Studio, but there's no output at all. (Other than what we generate from OutputDebugString, I guess.) So I'm sure it's a dumb question, but how do I get Lua output to the Visual Studio output pane?
David Dunham Development Manager
+1 206 926 5722 GameHouse Studios

AltStyle によって変換されたページ (->オリジナル) /