Jump to content


KaoS's Content

There have been 8 items by KaoS (Search limited from 10-February 22)


By content type

See this member's

Sort by                Order  

#157884 User Name Origin/Backstory

Posted by KaoS on 24 December 2013 - 02:15 AM in General

My full alias is actually KaoSDlanor, I have gone through many different ones in my past. Malleus was another favourite. KaoSDlanor actually comes from a Terry Pratchett book, he is the fifth and oldest horseman of the apocralipse (note the spelling). He spends his time hiding as a milkman by the name of Ronald Soak. As I am such a fan of his books I thought I would pay him tribute in my alias



#159732 When does garbage collection happen in CC?

Posted by KaoS on 08 January 2014 - 09:28 AM in Ask a Pro

AFAIK it tosses all data that is not accessible via a handle/variable as soon as the variable is redefined



#166172 KAOS: Boring-looking, multitasking operating system

Posted by KaoS on 25 February 2014 - 09:09 AM in Operating Systems

Even less new than you could've possibly imagined *cough* KaoShell has been around forever



#166401 Monitor change

Posted by KaoS on 27 February 2014 - 10:16 PM in Ask a Pro

you need to enclose your strings in quotes
side = "back"
cn = "Ovis Aries Industries"
mon = peripheral.wrap(side)
Active = "Nein"
mon.setTextScale(2)
if Active == "Nuke" then
while true do
mon.setCursorPos(1,1)
mon.write(cn)
mon.setCursorPos(1,2)
mon.write("Nuclear reactor: STABLE
mon.setCursorPos(22,9)
mon.write(textutils.formatTime(os.time(), false))
sleep(1)
mon.clear()
shell.run("Nuke")
end
end
if redstone.getInput("left")
then
Active = "Nuke"
mon.clear()
mon.setCursorPos(1,1)
mon.write("EMERGENCY. REACTOR MELTDOWN IMMINENT")
mon.setCursorPos(1,2)
mon.write("REACTOR SHUT DOWN.")
end



#171424 Necromancy

Posted by KaoS on 03 April 2014 - 12:57 PM in Forum Games

1 Month, 5 days 23 hours and 30 minutes

I've been sneakily lurking on this thread for a long time, thought it's high time I made my presence known

[Your time stamp was very close! Do you want to wear the Resident Necromancer title, or keep the Diabolical Coder title?

33 days 23 hours 32 minutes. -L]



#171427 icons/buttons?

Posted by KaoS on 03 April 2014 - 01:03 PM in Ask a Pro

View PostRoD, on 30 March 2014 - 04:42 PM, said:

Can i program my OS to display the files that are in a directory in the desktop as icons? i mean automaticaly take the files and display icons no matter how many they are.
I have looked up everywhere and i cant find a way of doing this. :/

yes, it is very similar to what was done above in fact. Just parse a table of all the files...



#194181 Lua: What would you change?

Posted by KaoS on 21 September 2014 - 07:47 AM in General

View Posttheoriginalbit, on 02 December 2013 - 10:05 PM, said:

i know that it is not possible for Lua to have the functionality because it is not a statically typed language, however that being said this topic doesn't need to make sense in the realm of what it possible, it was more just me seeing what other people thought, even if it were not possible without changing everything about Lua. I find it very interesting to find out peoples ideas, perceptions, and opinions of programming, no matter how feasible it is.

I'm returning from a leave of absence so this may be late but you CAN actually implement all of the suggestions in your original post with a simple Lua code that changes the loadstring and similar functions. the binary number is the easiest example

local loads=loadstring

local convertToDecimal(nBinary)
  return tonumber(nBinary,2)
end

loadstring=function(sCode,...)
  if type(sCode)=="string" then
	sCode=sCode:gsub("b([01]+)",convertToDecimal)
  end
  return loads(sCode,...)
end
I realize you still have to ensure that that b[01]+ is not enclosed by quotation marks but you get the idea. I make a simple Lua file with similar workarounds that I use often and just include it in all my projects when I'm coding them, later I copy across the code I need or convert it to traditional syntax

EDIT: Lol I just read more of the thread, looks like I've fallen into the same trap as many others. At least I'm suggesting a code that changes the way Lua works rather than forcing you to code how Lua works but I apologise for not keeping to topic. I too would like Lua to support more metatable events. That's pretty much my only gripe other than perhaps a better Regex version and the RETARDED multiline comment thing



#194182 Lua: What would you change?

Posted by KaoS on 21 September 2014 - 07:58 AM in General

View PostFerdi265, on 27 August 2014 - 04:41 PM, said:

sci4me said:

Functions with different parameters but the same name!!! Seriously, WHY IS THIS NOT A THING?
Because functions are values. having two functions with the same name is like storing two functions in one variable, which isn't quite possible. (also lua wouldn't know what to call if you did

It actually IS possible believe it or not. You use the same solution as I suggested above to replace all function creations with a table of all functions of the same name.
The table has a metatable __call that when called checks the type of all arguments and selects the best function from the functions stored in the table.
You also need a metatable extending code so you can make the table appear to be a function etc etc