Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

Molinko

Members
  • Content Count

    455
  • Joined

  • Last visited

  • Days Won

    35

Molinko last won the day on April 19

Molinko had the most liked content!

2 Followers

About Molinko

  • Rank
    Leading Member

Profile Information

  • Gender
    Not Telling

Recent Profile Visitors

2816 profile views
  1. I believe a motion sensor or radar in a drone could do the trick..
  2. I might be blowing smoke.. But I think you can put it in a disk drive and mount it on another computer to install an os
  3. Sadly I would need more information. Preferably your full code and the full error if available..
  4. local function list_files(dir) local files = {} for path, err in filesystem.list(dir) do assert(path, err) if not filesystem.isDirectory(path) then table.insert(files, path) end end return files end -- # use local files = list_files '/home' -- # example result -- { -- 'test.lua', -- 'poop.cfg' -- }
  5. You'll want to use the component.methods function. if component.methods('component_uuid')['method_name'] then -- # method is present end
  6. Firstly you're mixing up file:read and file:write.. One writes to the file and the other reads. local config = {} for line in io.lines "/path/to/config.txt" do table.insert(config, line) end print(config[3]) -- # 3rd line in your config -- # this is probably the simplest way but there are others. To read a specific line in a file you'd have to know the exact offset of bytes until the information you're trying to read.
  7. It writes to the current line of a new file, so in this case it'd be the 1st line. To read the first line just open the file in read mode ` file = io.open("myfile", "r") Ip = file:read("*l") file:close() ` *l reads 1 line from a file 1 reads one byte from a file
  8. file = io.open("/path/to/config.txt", "w") file:write(newIP) file:close()
  9. Molinko

    Text box

    Bummer.. I guess because user input is not strictly a file it's not behaving the way I expected.. perhaps you'll have to roll your own user input with event.pull..
  10. Molinko

    Text box

    I could be wrong about io.read... perhaps post your code so I can see what's going on.
  11. Molinko

    Text box

    Io.read should yield the thread until enter is hit or the arg to it is satisfied ie after 2 characters. setCursorBlink will only set the blink mode of the cursor
  12. Molinko

    Text box

    To limit the number of characters read you can pass a number to io.read. i.e `io.read(2)` As for the cursor blinking and overwriting your input box you can either make your input box larger or turn the cursor blinking off with `term.setCursorBlink(false)`
  13. Molinko

    Touch input

    The lib you're looking for are cursor.lua & full_cursor.lua but I'm not sure these will do what you're seeking to accomplish I just remember hearing about them... Also my example was done in a way that it could be modified to control the windows(and thus the cursors) of other processes. If you just want to access the current processes window it may be simpler with the tty lib. local tty = require "tty" local event = require "event" local kb = require "keyboard" local window = tty.window local handle = event.listen("touch", function(_, _, x, y) window.x = x window.y = y print "HI" end) while true do local ev = { event.pull("key", nil, nil, kb.keys.q) } event.cancel(handle) break end
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.