Jump to content




augustas656's read() replacement questions topic



  • You cannot reply to this topic
31 replies to this topic

#21 augustas656

  • Members
  • 158 posts

Posted 11 May 2014 - 04:16 PM

Oh yeah I used that because just incase if there's 0 arguements, just as an error check.
Edit: I just solved my issue, I'm using two tables, and checking up to a defined length.

Edited by augustas656, 11 May 2014 - 04:17 PM.


#22 augustas656

  • Members
  • 158 posts

Posted 11 May 2014 - 05:06 PM

bios.lua in github, doesn't have the custom char parameter, you know when you can make your password hidden when inputing text by typing read("*") putting a string in the paremeters to replace each and every character. Yeah the bios.lua file doesn't have it, I'm asking this because I made a custom read function that has a problem, I've tried copying the github's bios.lua read function into my API but it still didn't work on that one aspect, it's that when I type the text can go outside of screen borders, keeps typing eventhough I can't see it. Whereas the normal read() works! So I'm confused, what's the problem here. Since they are different and that is because there isn't a parameter in the bios.lua file for a custom string replacing each character, I wanted to check maybe the script is different so it may fix my problem!

Regards
Augustas

#23 Lignum

  • Members
  • 558 posts

Posted 11 May 2014 - 05:11 PM

Are you referring to this page? On line 226 it's _sReplaceChar.

#24 augustas656

  • Members
  • 158 posts

Posted 11 May 2014 - 05:18 PM

Thanks!

#25 Lignum

  • Members
  • 558 posts

Posted 11 May 2014 - 05:18 PM

View Postaugustas656, on 11 May 2014 - 05:18 PM, said:

Thanks!
You're welcome.

#26 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 11 May 2014 - 05:59 PM

View Postaugustas656, on 11 May 2014 - 04:14 PM, said:

Updated Version:
Spoiler

Unlike the read() function, this for some reason doesn't move the entire string when there are characters out of bounds, so if I keep typing characters after the string has reached the end of the screen, it will go beyond the border and I will not see. How can I fix this!? So frustrating can't find the error, looked through my code and it's literally identical apart from the additions to the bios.lua one.

Edit: I highlited red where I think this problem occurs.
Without reading your code, I would say just do this
local tx, ty = term.getSize()
local cx, cy = term.getCursorPos()
if tx > cx then
 term.setCursorPos(1, cy + 1)
end


#27 augustas656

  • Members
  • 158 posts

Posted 11 May 2014 - 07:16 PM

I'm trying to make a multi-line supported read function, and I'm thinking to stop reading you press enter, to create a new line you hold shift and press enter, possible?

Regards
Augustas

#28 Lignum

  • Members
  • 558 posts

Posted 11 May 2014 - 07:20 PM

Maybe the ctrlkeys API will help?

#29 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 11 May 2014 - 08:26 PM

Threads merged. Stop creating new topics for different questions about the same piece of code.

#30 augustas656

  • Members
  • 158 posts

Posted 13 May 2014 - 04:57 PM

I get an error: bios:114: bad arguement: number expected, got nil
Code: http://pastebin.com/wzgFB8Wx

Help please

#31 CometWolf

  • Members
  • 1,283 posts

Posted 13 May 2014 - 05:18 PM

My Bios (1.58) line 114 is just an end statement, so we obviously don't have the same one. Open up your own and have a look, it should point you in the right direction.

#32 augustas656

  • Members
  • 158 posts

Posted 17 May 2014 - 04:43 PM

I have version 1.6 Beta pr2, it may have changed, no? Where do I find the bios file?
EDIT: Fixed it, in string.sub, I had an incorrect arguement.

Edited by augustas656, 17 May 2014 - 04:48 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users