Re: LuaD + VisualD link issue
On Tuesday, 12 August 2014 at 22:25:24 UTC, Johnathan Sunders wrote: I'm having an issue with building programs that link with LuaD using VisualD. If I use Dub, it builds without an issue, but generating a project file and compiling it through VisualD results in Error 162: Bad Type Index reference to type 84A9 when linking luad.lib(base). Anyone has any ideas on what may cause this? I've also tried building using the VisualD project on LuaD's GitHub in case it was a missing configuration setting but that has the same issue (running Windows 8 64 bit in case it's relevant). I wondered if you ever found a solution to this issue? I am having exactly the same problem. Basically I did this 1. Generated a simple app with dub and added luad as a dependency. 2. Compiling the app with dub works fine. Can call Lua ok. 3. Asking dub to generate a VisualD project file and then trying to compile the same app in VisualD fails, in my case the error is Error 162: Bad Type Index reference to type 5C55. I have tried copying the VisualD project from the dub's Luad folder into my own solution and compiling it manually, but I run into the same problem. As an aside, I should add that this is an attempt to workaround my original problem - I want to use a dub package (LuaD) in an existing VisualD project that I created using VisualD - not sure if that is possible? Wild guess: There is an enigmatic README.md in the LuaD distribution https://github.com/JakobOvrum/LuaD/blob/master/extlib/README.md which might contain a clue as to the problem. I am running Windows 8 64 bit, the VisualD project is Win32 configuration. Changing the configuration to Win64 yields error ..\luad-master\extlib\lua5.1.lib : fatal error LNK1136: invalid or corrupt file
Re: Baffled by compilation error for formattedRead
On Thursday, 7 May 2015 at 23:23:08 UTC, Justin Whear wrote: formattedRead takes its input by ref and consumes it. Your first two attempts are both passing the result of functions (dropExactly and opSlice) which are temporary rvalues and can thus not be passed by reference. Here's more reading on the subject of rvalues: http:// ddili.org/ders/d.en/lvalue_rvalue.html Ok, thanks, I see. It looks a little weird, but there is the same restriction in C#, actually. Must learn to read those D function signatures more closely...My excuse is it's 1 am :-)
Re: Baffled by compilation error for formattedRead
On Thursday, 7 May 2015 at 23:10:26 UTC, PhilipDaniels wrote: Let's try reformatting that... ubyte r, g, b; // does not compile auto numRead = formattedRead(dropExactly(input, 4), %x/%x/%x, r, g, b); // does not compile auto numRead = formattedRead(input[4..$], %x/%x/%x, r, g, b); // compiles string s2 = input[4..$]; auto numRead = formattedRead(s2, %x/%x/%x, r, g, b);
Baffled by compilation error for formattedRead
Given a string string input = rgb:20/30/40; And the following: ubyte r, g, b; auto numRead = formattedRead(dropExactly(input, 4), %x/%x/%x, r, g, b); // does not compile auto numRead = formattedRead(input[4..$], %x/%x/%x, r, g, b);// does not compile string s2 = input[4..$]; auto numRead = formattedRead(s2, %x/%x/%x, r, g, b); // compiles Why do the first two fail to compile but the last one does?! I cannot see any difference between the 's2' case and the second case, it is a completely mechanical source code transformation I have made.
Re: Create a case-insensitive startsWith
On Tuesday, 28 April 2015 at 22:34:07 UTC, Justin Whear wrote: if (startsWith!icmp(a, b) == 0(input, 0x)) if (startsWith!std.uni.icmp(a, b) == 0(input, 0x)) if (startsWith!((a,b) = icmp(a,b) == 0)(input, 0x)) The issue is that those icmp functions take strings as arguments while startsWith expects the predicate to take individual characters. Thanks. That seems obvious now that you mention it but honestly I could not tell that from the documentation :-( I believe the best solution here is to use the lazy toLowerCase function in std.uni and the default predicate: if (startsWith(input.toLowerCase, 0x.toLowerCase)) I think I will have to make a string idioms wiki page...
Create a case-insensitive startsWith
Beginner question. Given if (startsWith(input, 0x, 0X)) How do I turn that into a case-insensitive startsWith? startsWith says it takes a predicate but I can't figure out how to pass it one. The examples all use a == b !? These attempts below, and other things I have tried, fail with cannot deduce function from argument types. if (startsWith!icmp(a, b) == 0(input, 0x)) if (startsWith!std.uni.icmp(a, b) == 0(input, 0x)) if (startsWith!((a,b) = icmp(a,b) == 0)(input, 0x))