Some lua tricks you may not have known...
#41
Posted 25 November 2012 - 11:06 PM
#42
Posted 27 March 2013 - 07:41 AM
Added a section on metatables, trapping arguments in tables, and iterators.
#43
Posted 27 March 2013 - 09:46 AM
#45
Posted 28 March 2013 - 03:00 AM
[=[ This is [[cool]] ]=]You can add up the ='s like this
[==[ [=[hey]=][hey] ]==]Etc.
Cheers Alexander
EDIT: This could also fix a bug in lightshot with some brackets in the edit program not showing
#46
Posted 28 March 2013 - 03:02 AM
superaxander, on 28 March 2013 - 03:00 AM, said:
[=[ This is [[cool]] ]=]You can add up the ='s like this
[==[ [=[hey]=][hey] ]==]Etc.
Cheers Alexander
EDIT: This could also fix a bug in lightshot with some brackets in the edit program not showing
PIL extract
#47
Posted 28 March 2013 - 03:04 AM
TheOriginalBIT, on 28 March 2013 - 03:02 AM, said:
superaxander, on 28 March 2013 - 03:00 AM, said:
[=[ This is [[cool]] ]=]You can add up the ='s like this
[==[ [=[hey]=][hey] ]==]Etc.
Cheers Alexander
EDIT: This could also fix a bug in lightshot with some brackets in the edit program not showing
PIL extract
#48
Posted 28 March 2013 - 03:05 AM
#49
Posted 28 March 2013 - 03:07 AM
#50
Posted 28 March 2013 - 03:09 AM
EDIT: I think I'll move this to PM... no thread hijacking
#51
Posted 28 March 2013 - 03:12 AM
#52
Posted 08 April 2013 - 11:29 AM
#53
Posted 08 April 2013 - 11:40 AM
Kilobyte, on 08 April 2013 - 11:29 AM, said:
slowPrint() has a purpose and I would not advocate removing it. Occasionally people do have a valid reason to use it and taking it out would be pointless. Of course, noobs have a tendency of using it far too much which can be annoying, but if they want to make their code slow then that is up to them.
Valid use of it:
local menu = [[- File Edit Update Config About]] term.setBackgroundColor(colors.white) term.clear() term.setBackgroundColor(colors.red) term.setCursorPos(1,1) term.clearLine() local display = false while true do term.setBackgroundColor(colors.red) term.setCursorPos(1,1) term.clearLine() if display then term.setBackgroundColor(colors.blue) end textutils.slowPrint(display and menu or "+") local e = {os.pullEvent()} if e[1] == "mouse_click" and e[3] == 1 and e[4] == 1 then display = not display elseif e[1] == "key" and e[2] == keys.enter then return end end
Admittedly, the above code is not a very good example of slowPrint. But it does show that it has a purpose making interesting text effects.
#54
Posted 04 May 2013 - 12:23 PM
You should also be able to override it with metatables in most implementations of lua, though I'm not certain if the CC implementation supports this.
#55
Posted 04 May 2013 - 12:53 PM
Pharap, on 04 May 2013 - 12:23 PM, said:
#58
Posted 04 May 2013 - 01:16 PM
#60
Posted 04 May 2013 - 01:33 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users