Logic World Wednesdays: Labels & Grids


View this post on logicworld.net

Label UI - Jimmy

Labels are blocks with editable text on them. I added them to Logic World a while ago, but there hasn’t been an in-game way of editing them. This week I finally added that menu, as well as the ability to change the labels’ color!

Grid Placing - Jimmy

Grid Placing is a new feature that lets you quickly place many components in a grid.

One of my goals with Logic World is to make the building mechanics fast and easy to use, and Grid Placing is a big part of that!

C# to JS - Felipe

I'm finally back from vacation! Unfortunately I'm going to have less time for LW stuff as I'll be busy with school, however this week I did have time to add something to my vue-aspvalidate library: as you may remember from my last LWW section in order to, say, validate an email there has to be a snippet of C# code that validates it in the back-end and a snippet of JS that validates it on the front end, which meant writing duplicate code for each kind of validation. This is obviously less than ideal as you’re writing everything twice, so I set on to find a way to take C# code and translate and send it to the client.

I arrived at a solution using the wonderful LINQ Expressions API in C# that lets you pass a method a lambda (i.e. value => value.Length > 10) and then go through it using an ExpressionVisitor, which lets you see the lambda as a regular C# object of a type derived from Expression. For example, the previous example would call the VisitBinary method on your visitor, which in turn lets you visit the left and right sides of the > operator and so on.

This means that a single-line validator like value => value[2] == ‘@’ && value.StartsWith(“lol”) || Regex.IsMatch(value, “.*?%$”) gets translated to the JS code value => value[2] == “@” && value.startsWith(“lol”) || new RegExp(“.*?%$”).test(value). As you can see, some BCL methods get translated to their JS counterparts, allowing me to write complex validators without worrying about writing any JS code!


If you’d like to receive an email each time we post one of these blogs, you can sign up for our newsletter. Be sure also to join the official Discord.

See you next Wednesday!

Get Logic World

Buy Now$15.00 USD or more

Leave a comment

Log in with itch.io to leave a comment.