What is the code you made for Lua’s print() and io.read() function?

Asked

Viewed 226 times

0

What is the code they made for the function print() and io.read() of the Moon, I want to make a programming language so I need to know.

  • Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).

1 answer

3


When you want to see how a function works in Lua go to the Github of hers and see. For example print() and io.read(). You have to follow what it calls to try to understand what it does, but these specific functions clearly end up calling the API of the operating system.

If you evaluate every source of Lua, and I highly recommend it for your intention even for being one of the most simple and well written useful languages that exists, practically without gambiarras and everything well thought out, you will see that there is a mapping to real functions in C. Lua modules are only tables whose elements are the keys to the functions in C and the values a pointer to them.

Although I like your idea, making a programming language is not simple and the fact that you don’t know how to find it on your own makes you wonder if you’re ready to run it. The way Moon does may not suit your need.

  • I liked how it does, and I am looking precisely for the system api as I will start with the prompt

Browser other questions tagged

You are not signed in. Login or sign up in order to post.