background preloader

Learn Lua in 15 Minutes

Learn Lua in 15 Minutes

catalog You have constructors on subclasses with mostly identical bodies. Create a superclass constructor; call this from the subclass methods. more… Two subclasses have the same field. Move the field to the superclass. more… You have methods with identical results on subclasses. Move them to the superclass. more… A field is used only by some subclasses. Move the field to those subclasses. more… Behavior on a superclass is relevant only for some of its subclasses. Move it to those subclasses. more… You have conditional code that is unnecessarily verbose and does not use the most readable Ruby construct. Replace the conditional code with the more idiomatic Ruby construct. more… Remove Assignments to Parameters The code assigns to a parameter. Use a temporary variable instead. more… You have a variable that is acting as a control flag for a series of boolean expressions. Use a break or return instead. more… A class is doing too much simple delegation. Get the client to call the delegate directly. more… more… Remove it. more…

Tutoriels/Apprendre à programmer en Lua - Wiki CraftStudio Ce tutoriel (ou plutôt cette série de tutoriels) est destiné aux développeurs en herbe souhaitant apprendre à programmer. Il vise à enseigner les concepts de base de la programmation que sont les variables, les conditions, les boucles, les tableaux et les fonctions dans le contexte du Lua et de CraftStudio. Ces concepts ne sont spécifiques ni au Lua ni à CraftStudio. Ils sont quasiment identiques dans la plupart des langages de programmation, aussi vous pouvez retrouver tous ces concepts expliqués légèrement différemment dans la plupart des tutoriels de programmation pour débutant. Je conseille d’ailleurs vivement en complément de ce tutoriel, de lire d'autres tutoriels dans d'autres langages de programmation afin de bien comprendre ces concepts. Vous en trouverez de nombreux d’excellente qualité en français notamment sur le SiteDuZéro. Pour les anglophones par contre, il existe déjà de nombreuses ressources disponibles concernant Lua, dont :

Game of life: Code solution in C# Download Game Of Life - 25.1 KB Introduction Let us start with an introduction to the GAME OF LIFE problem. As per wiki “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.” The "game" is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, live or dead. Any live cell with fewer than two live neighbours dies, as if by loneliness. The initial pattern constitutes the 'seed' of the system. Problem The inputs below represent the cells in the universe as X or - . Block pattern Boat pattern Blinker pattern Toad pattern It is important to note that in Output D, the two new rows have been due to Rule #4 i.e. Background The other catch is the need of implementation in Object oriented fashion which is a bit tricky. History

LUA : pour les Débutants visual c++ - Difference between Windows and Console application Tutoriel Lua 1-a. Introduction▲ Ce tutoriel, qui s'adresse plus spécialement aux débutants, explique la façon d'écrire du code avec le langage de script Lua, dans le cadre d'une utilisation sous Windows. J'ai repris pour l'essentiel, ma traduction précédemment effectuée du manuel de référence intitulé : « Lua 5.2 Reference Manuel », que j'ai reformatée sous forme d'un tutoriel afin d'en rendre la lecture plus agréable, plus fluide et moins rébarbative. Les interactions de Lua avec un hôte écrit en C ne seront pas abordées, ce qui signifie qu'il ne sera pas question ici des bibliothèques de l'API C (lua_xxx), ni des bibliothèques auxiliaires (luaL_Xxxx). Lua étant un langage de script, il ne peut pas devenir exécutable au sens où on l'entend habituellement, comme avec les programmes écrit en C ou C++ et compilés pour tourner sous Windows (*.exe). Mais il existe un « wrapper(1) » du nom de wxLuaFreeze.exe qui permet d'exécuter les programmes « comme si », ils étaient vraiment Standalone(2). 1-b. 1-c. etc.

Right-Click, Create Unit Tests - MSDN Malaysia For those who are disappointed with the removal of the "Create Unit Tests..." context menu in Visual Studio 2012, here are few methods for you to re-enable the feature: Method 1 - Command Window If you find hard enough, you will discover that the command to invoke the Create Unit Tests... is actually: EditorContextMenus.CodeWindow.CreateUnitTests You can actually type that in the Command Window to invoke the Create Unit Test Wizard. If you find it too verbose, you can actually create an alias for it. alias ut EditorContextMenus.CodeWindow.CreateUnitTests Then just type ut to launch the wizard. Method 2 - Keyboard Shortcut The next method is to go to Tools->Options->Environment->Keyboard and set a shortcut key of your preference. Method 3 - Re-enable the Create Unit Tests... Thanks to our MVP Serena Yeoh for sharing such a great information with us, you can click here to see the full details.

CodeBetter.Com - Stuff you need to Code Better! .net - C# Equivalent of SQL Server DataTypes

Related: