how is the lua language able to be run inside of cc on the computers? I am trying to figure out how cc actually implements the lua system and i cant find anything to show how to do it. I want to know like actually how to get lua to run in minecraft or how to embed it or anything. Thank You and all help is much appreciated
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
how is lua in cc
Started by cmdpwnd, 23 March 2014 - 02:41 PMPosted 23 March 2014 - 03:41 PM
Ok so my question is very easy and very hard at the same time as I haven't been able to find any documentation on how to do so.
how is the lua language able to be run inside of cc on the computers? I am trying to figure out how cc actually implements the lua system and i cant find anything to show how to do it. I want to know like actually how to get lua to run in minecraft or how to embed it or anything. Thank You and all help is much appreciated
how is the lua language able to be run inside of cc on the computers? I am trying to figure out how cc actually implements the lua system and i cant find anything to show how to do it. I want to know like actually how to get lua to run in minecraft or how to embed it or anything. Thank You and all help is much appreciated
Posted 23 March 2014 - 03:52 PM
LuaJ, java library implementing a full lua interpreter in java. Computercraft "simply" adds the LuaJ library to minecraft and wraps it up inside some neat little blocks (ok, more complicated than that). As for how LuaJ works, its open source.
Edited on 23 March 2014 - 02:53 PM
Posted 23 March 2014 - 05:07 PM
Ok I see I can wrap my head around that, but if im going to use it does that mean ill have to add it as a library in say, eclipse? Also what exactly do you mean when adding the LuaJ library TO Minecraft. Do you mean adding it to the game itself or through your mod it is run "in" blocks?
Posted 23 March 2014 - 05:26 PM
I'm not sure how LuaJ works exactly, but assuming if it works similar to Lua in C, you would load it as a libary (and pack it with the mod) and register functions that lua can call, but executes code in Java (Like rendering, fs, etc.).
Edited on 23 March 2014 - 04:27 PM
Posted 23 March 2014 - 05:54 PM
Could you reference me to a link that might show code to explain this? When you explained it Is the logic as such: in a java file you import the LuaJ library, then using that library you reference .lua files from which your mod can access yes?
Also could you explain possible ways that the computers are able to display a prompt and let you interact with the lua interpreter?
Also could you explain possible ways that the computers are able to display a prompt and let you interact with the lua interpreter?
Posted 23 March 2014 - 05:59 PM
so basically, you're here on the ComputerCraft forums to ask how it works so you can make a rival mod?
Posted 23 March 2014 - 06:18 PM
No im looking to how would you say, "modify the mod" I don't want to make a new mod, im looking to make a new os that simulates cisco networking devices. I asked how it displays so that I can alter the display. I am also looking to add new items to the mod such as a switch, server, and router (referencing cisco devices). My intention for this is to get a group of friends together to learn Cisco so that we may qualify for CCNA and the best way since we don't have set schedules is to work on them in minecraft its just easier
Posted 23 March 2014 - 06:20 PM
You can go and look at the mod's code (it's not open source though, so you'll have to deobfuscate if yourself) and see how it's all done.
EDIT: Damn ninja. Also, you cannot distribute modified versions of ComputerCraft. If you want a computer mod that toy can play with and distribute modded versions (and one that is open source) try OpenComputers. It's written in Scala, though, so you might need to learn that if you haven't already.
EDIT: Damn ninja. Also, you cannot distribute modified versions of ComputerCraft. If you want a computer mod that toy can play with and distribute modded versions (and one that is open source) try OpenComputers. It's written in Scala, though, so you might need to learn that if you haven't already.
Edited on 23 March 2014 - 05:23 PM
Posted 23 March 2014 - 07:03 PM
Thanks, I would probably still use CC if I could figure out how to separate a string and use it for shell.run() so that my OS would work properly but this is easier to do in OC as I have just figured it out.
Posted 23 March 2014 - 07:08 PM
lol, shell.run seperates strings by space automatically….
Posted 23 March 2014 - 09:44 PM
If you are looking to get your CCNA, use Cisco packet tracer, if you have a cisco net academy account it is free and it runs perfectly fine under WINE on both OSX and linux. I'm a computer science student and our networking module is designed to line up with the CCNA certification, we use both real hardware and packet tracer, packet tracer is about as close as you can get to the real hardware short of the real hardware funnily enough. Will be much more productive than trying to fanny around in minecraft to achieve the same goal. Time you spend trying to bend minecraft to your will could be better spent making sure that you don't do what I did the other day which is to spend ages wondering why you can't ping a router over Serial0/0/0 only to realise that the clock rate had not been specified on the other router (which was DCE).No im looking to how would you say, "modify the mod" I don't want to make a new mod, im looking to make a new os that simulates cisco networking devices. I asked how it displays so that I can alter the display. I am also looking to add new items to the mod such as a switch, server, and router (referencing cisco devices). My intention for this is to get a group of friends together to learn Cisco so that we may qualify for CCNA and the best way since we don't have set schedules is to work on them in minecraft its just easier
Posted 23 March 2014 - 11:48 PM
lol oh yes the clock rate, I also had that problem the first time I tried. Or worse when you do an all-route to a directly connected device that has no ip
Posted 24 March 2014 - 12:54 AM
My intention for this is to get a group of friends together to learn Cisco so that we may qualify for CCNA and the best way since we don't have set schedules is to work on them in minecraft its just easier
You'll find it "easier" to concentrate on the official stuff in your own time, as THAT is what the exams concentrate on. Having a decent network simulator may aid your understanding as to how everything plugs together and should be configured, but it has little to do with passing. Go through the official CCNA stuff. Go through it again. Do the tests.
Even if you're of the belief that "practical knowledge will help you in the real world", MineCraft is FAR from the real world, and your ability to create a realistic sim is going to be further hindered by any holes in your current knowledge.