- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
natedogith1
-
Content Count
36 -
Joined
-
Last visited
-
Days Won
2
Posts posted by natedogith1
-
-
If you sneak right click with an empty hand, the robot should start. And robots can sneak right click.
-
Did you remember to pass your main function, rather than the results of executing the main function, to pcall. Your error handling code should probably look something like this (if you're using pcall):
local ok, err = pcall(main) -- notice no () if not ok then stopTimer() print(err) end
-
As a general rule of thumb, the name of a texture is modid + ":" + blockName
And after a bit of searching, I believe the fluids you're looking for have the following texture names:
tconstruct:molten_enderiummo:matter_plasmatconstruct:molten_stonethermalfoundation:fluid/Fluid_ender_Stillthermalfoundation:fluid/Fluid_ender_Flow -
I'm only receiving the last line from the file in my table so there's only 1 entry?
What code are you using to unserialize the file? (if you had said it was the first line you might have gotten around it by making the file contain one table instead of two (wrap the entire thing in {}))
Maybe you need to remove the trailing comma from the lines - every line except the last one has a comma at the end, and a trailing comma isn't valid table/serialization syntax, that would explain why only the last line loads.
Actually, from the lua manual (section 3.4.8 or 3.4.9 - Table Constructors) "The field list can have an optional trailing separator, as a convenience for machine-generated code."
-
Just tried with fire fox on windows 10, doesn't happen there. But this issue does still exist on windows 10 google chrome.
-
The nanomachines have a "saveConfiguration" method, that when executed will save the configuration to an unconfigured nanomachine item in your inventory.
-
The only way I'm aware of that you can get NBT is using the getTileNBT method of the debug card. However this is a creative-only item. Though it seems you might be able to use the crop as a component if you have open peripherals installed.
-
You're going to want to do write the bytes to the stream using string.char
As an example, you can look at a program I made a while ago (it's slow from what I recall, but I was just testing stuff). http://pastebin.com/NLvQmUYh
-
What style of server is it? Mostly I'm just curious if it's creative or survival or something else. (couldn't seem to find the info on your site, though that could be because I'm not registered)
-
The delay is a config value, by default it's one second. I'd recommend waiting for a response from the nanomachines, that way you never send the next message early.
-
By "skipping" do you mean that computer.pullSignal's yield cannot be "caught" by user code?
That's precisely what I mean.
-
Yes, I "knew" that (i. e. I read that piece of code once before). Though I don't understand how this relates to computer.pullSignal and "skipping" coroutines.
computer.pullSignal uses the bubbling yield (rather than the user-exposed yield)
-
Just curious, what exactly do you mean with that? Coroutines aren't like threads, Lua doesn't automatically run them concurrently. Logically if you call computer.pullSignal in one coroutine, that will block all execution, even if you have some kind of "manual threading" (Plan9k).
OpenComputer wraps calls to coroutine.yield and coroutine.resume so that they can bubble sysyields. It's part of how OC handles component methods. (if you want to look at the code that does the yielding stuff you can check here )
-
Aside from what Gangsir fixed, os.pullEventRaw doesn't exist in OC. Also, computer.pullSignal skips over all user created coroutines (so you'd need to override computer.pullSignal or event.pullFiltered to call coroutine.yield).
-
This seems like a similar issue to http://oc.cil.li/index.php?/topic/413-computers-on-same-network-conflict-with-eachother/?hl=raid
-
You might be able to convert this implementation to lua. Also, why are you checking if "/" is readonly rather than checking /tmp ?
-
I think os.date might be calculating things incorrectly, as it's designed for the minecraft world, not the real world. You could use another implementation top get a better value. (Also, while not an ideal option, if you have an internet you could use a web api (I've done that with computer craft))
-
Other than a loop you'd also need to: keep track of the state, make sure one step equals one trigger, sleep
local component = require("component") local sd = require("sides") local rs = component.redstone local oldSignal = false local state = false while true do local signal = rs.getInput(sd.front) > 0 --check if we have a redstone signal if signal ~= oldSignal then --make sure we don't trigger twice when the plate was stepped on once ' oldSignal = signal state = not state --make it so we toggle if state then print("Opening door") rs.setOutput(sd.right, 15) else print("Closing door") rs.setOutput(sd.right, 0) end end event.pull("redstone_changed",rs.address,sd.front) --sleep until redstone input on our device's front changes ' end
-
True, it does assume that the contents are text. For Lua code that shouldn't be an issue though - leading newlines don't matter, and line endings are all the same to Lua.
Line endings may be the same to Lua, but they might not be to the compression code. For instance, if I were to replace all instances of "local " with "\0\13" and put that in a long string and read it in, my algorithm would break. (\13 is \r)
-
Or use [[raw multiline strings]], which take all characters literally, except for the closing brackets. This is even possible if there are such strings in the code itself - Lua allows you to add any number of equals signs between the two brackets, and they will still be valid, as long as the opening and closing ones use the same number of equals signs. For example, the text
This string has [[brackets]] in it for some reason.
would break normal multiline strings, but can still be stored like this:[=[This string has [[brackets]] in it for some reason.]=]
actually, \n and \r characters at the begining and end will be striped out, and \r will be converted to \n
-
as far as I'm aware there are three ways to do that sort of compression, each with its own upside/downsides
return load((source):gsub("\0","function"))() --good if you're only have one key word return load((source):gsub("\0(.)",{a="function",b="local",c="table",d="string"}))() --good general solution for multiple key words, relatively easy to read the shortened version of return load((source):gsub("\0(.)",function(a)return({"function","local","table","string"})[a:byte()]end))() --grows slower than the table version as you add words, but requires more space in the beginning --probably require more RAM than the table version --should only use over the table version if you have more than 8 key words
where (source) is a string representation of the source codeI use \0 because you're almost guaranteed never to run in to it, but code that generates these should probably search for an unused character (preferably a printable one)
also, I'd like to note from my attempt at implementing this: the only characters that need escaping are the things that close your strings (double quote (") or single quote (')), newline, carriage return, and backslash. You could also try backslash to not have to worry about escaping the carriage return
-
You could probably do something with overriding pullSignal
-
If I'm reading the source code right, it looks like it'd return an empty string if the connection was closed, and null if no bytes were read.
-
I was making a thing with tcp via the internet card, but I ran into a thing. How do you check if the server closed the connection? I think I can pcall the internet component's finishConnect method to check if the connection has been closed, but that feels hacky and unreliable.
[Fixed] non-https forum
in Website
Posted
The non-https forum isn't set up properly. It leads to a "Welcome to nginx!" page. (go to http://oc.cil.li/ instead of https://oc.cil.li/ to see the issue).