Questions tagged [computercraft]

ComputerCraft is a Minecraft mod which adds Lua-based scripting.

ComputerCraft (often also called CC) is a modification for the game . It adds new blocks (known as Turtles and Computers) and Items (known as Pocket Computers) to the game. They can be programmed using -based scripting.

141 questions
2
votes
1 answer

computercraft/lua program looping unable to maintain signal output

I'm trying to write a program that gets the time from the os.time() function and use that to change a redstone output. When rebooting, the program is set to auto-run, but since I reboot to cause the program to restart, it interrupts then starts the…
2
votes
2 answers

How to group values in double dimension table?

I try to group values in a double dimension table in an other table, but without duplicates. All attempts i made create a table with duplicates. Here's an example: This is my table: tab1 = { {id = "id1", dmg = 0, qty = 1}, {id = "id2",…
aquilon
  • 31
  • 3
2
votes
2 answers

Use table key inside same (anonymous) table

I want to use a key insde an anonymous table from within that same table, like so: loadstring( [[return { a = "One", b = a.." two" }]] ) From my perspective, this should return the following table: { a = "One", b = "One two" } However, it just…
RedPolygon
  • 63
  • 1
  • 9
2
votes
2 answers

A program to enable local by default variables

So I've become annoyed at the global by default style in Lua. I'm trying to write a program which will make all programs that run after it incapable of creating global variables. When they try to, that variable will be set to the function…
ViperLordX
  • 125
  • 1
  • 10
2
votes
1 answer

How do I procedurally iterate through similar variables in Lua?

I have a lot of variables that seem to lend themselves to be referenced a lot easier, but I'm not sure how to do it; the variable names are related to entries on a coordinate system, and where they are written to is also coordinate based. I have…
fileinsert
  • 431
  • 4
  • 22
2
votes
2 answers

Lua attempt to call nil

So I have this Lua script : function dispTanks() mon.setCursorPos(offsetPos, 1) mon2.setCursorPos(offsetPos,1) for i=1, #machines do -- RC Tanks -------------------------------------------- if string.find(machines[i],…
Kev30
  • 119
  • 1
  • 9
2
votes
1 answer

Press any key in 5 seconds

To clarify, I am using ComputerCraft (emulator: http://gravlann.github.io/, language: Lua) I know that to wait for a keypress os.pullEvent("key") and to wait 5 seconds I need to use this sleep(5) but I want to wait for a keypress and disable the…
Piper McCorkle
  • 1,044
  • 13
  • 27
2
votes
6 answers

Having trouble with some computercraft/lua code

Hi I want my lua code in Computercraft to allow the user to turn the redstone signal on/off by right clicking on a monitor on top, but I can't get it to work. monitor =…
user3412375
  • 51
  • 1
  • 1
  • 3
2
votes
1 answer

Website link protection

I want to upload information into a MySQL in ComputerCraft in Minecraft. ComputerCraft uses Lua. I tried to look for a way in Lua. I saw LuaSQL, but that was not a possibility because I can not install external files on the server. I figured out a…
user65130
  • 51
  • 3
2
votes
3 answers

Online database in Lua/ComputerCraft

I want an online storage that can connect with ComputerCraft in Minecraft. ComputerCraft is Lua-based. I have heard that you can not use MySQL in Lua. Is there some sort of online database like MySQL that I can use in Lua without installing external…
user65130
  • 51
  • 3
2
votes
2 answers

Variables Resetting When Using Parallel Function in Lua with ComputerCraft

I am a beginner designing a Lua program in ComputerCraft (Minecraft) that asks the player for their name the first time they use it, and records it. For now, I want a program that detects if the variable firstnameis equal to nil and asks for the…
Wookieguy
  • 231
  • 1
  • 4
  • 11
1
vote
0 answers

Is it possible to add lore to a floppy disk?

I'm working on a project that uses floppy disks like cards, and I wanted to know if there was any way I could display information on the "card" using the minecraft lore system. Currently I have no clue if this is possible or not.
CyMc
  • 11
  • 2
1
vote
0 answers

How to get data from a sign Computer Craft

is there a way of getting what is written on a sign from a turtle, the furthest I've gotten is getting that it's a sign... yeah. If anyone knows how to do it, please do tell. To make it more clear, I have a sign with "Hello" written on it, I want…
1
vote
1 answer

(ComputerCraft) (minecraft version 1.7.10) (question) Make a language file reader

I'd like to make a language reader for my operating system, but I cant find anything that helps me. I want to put the list into my other script. Heres the de-de language file (location: /os/bin/): de = { Menu = "Menü", Shutdown =…
DanielMo09
  • 25
  • 7
1
vote
1 answer

I'm using ComputerCraft, a minecraft mod that adds computers, modems, and other peripherals. In this mod, you can write code using Lua

This is my first time using Lua, and with following a tutorial, Im making a chat program, allowing two players to send and receive messages to each other. The receiving is called chatreceive.lua. The script is: rednet.open("right") sender, message =…
Ben G
  • 21
  • 1
1
2
3
9 10