Home > Net >  i have 0 experience in programming and tried to start learning lua and dont understand some things
i have 0 experience in programming and tried to start learning lua and dont understand some things

Time:11-14

so to learn it i am using this video https://www.youtube.com/watch?v=iMacxZQMPXs&t=147s but in it the person doens't enter his code in the command line but in what i think is a file and i dont know how to do that

another thing is that if i execute a command i can't edit it afterward or atleast can't figuere out how

sorry if i'm not super clear but i just dont know the name of certain things

CodePudding user response:

Tutorials are kind of useless if you don't listen carefully.

https://youtu.be/iMacxZQMPXs?t=30 here he explains where to get Lua binaries and that he does not need to install them as it is pre-installed on OS X. Windows does not have Lua binaries pre-installed so you need to get them first.

https://youtu.be/iMacxZQMPXs?t=53 here he explains that on the left side of his screen he has a text editor (https://www.sublimetext.com/) and on the right side he has a terminal which would be the command line if you're on Windows.

https://youtu.be/iMacxZQMPXs?t=63 here he writes a simple program and saves it as luatut.lua and then in the terminal executes that using the command lua luatut.lua.

So all you need is a text editor (any will do) and the lua binaries and some very basic computer knowledge. if you don't know how to run a executable from your command line / terminal learn this befor you continue any programming. You learn how to open a car door befor you learn how to drive.

Under Windows after installing Lua, you can run lua.exe from the command line. as first argument you provide a file name which lua will then run. So either change your current workign directory to the file's location befor you run this command or use a full path.

CodePudding user response:

You can create and edit files using a text editor like Notepad (or even normal Notepad), so long as you have the right filename extension—in your case, it would be .lua. Alternatively, you can use an IDE, such as Visual Studio Code; these applications have support for coding, such as highlighting and semantics and such.

And yes, once you execute a command in the terminal you cannot edit it. However, you can use the Up and Down keys to get to past run commands, if you needed to make a little tweak from what you were doing before.

  • Related