0 Members and 3 Guests are viewing this topic.
-- localslocal line = graydraw.linelocal wait = misc.waitlocal setcolor = graydraw.setcolorlocal text = graydraw.textlocal exitprog = misc.exitlocal print = nbdraw.printlocal find = string.findlocal setCursor = nbdraw.setcursorlocal strsub = string.sublocal strlen = string.len--[[--CalGUI (Pronounced Cal-gew-ey), a GUI library for LuaFXBy flyingfisch Last Updated 1/05/2012This project is free and open source.--]]----[[--Class definition systemBorrowed from LuaNspireThanks to adriweb for code--]]--class = function(prototype) local derived = {} local derivedMT = { __index = prototype, __call = function(proto, ...) local instance = {} local instanceMT = { __index = derived, __call = function() return nil, "ERROR: Attempt to invoke an instance of a class" end, } setmetatable(instance, instanceMT) if instance.init then instance:init(...) end return instance end, } setmetatable(derived, derivedMT) return derivedend--[[--Input text system--]]--function input()setcolor(false) --set 5-color mode "false"i = 1parse = ""print(parse .. "_")--keystrokeswhile not key(5) dorepeat--non-alpha:if alpha == 0 thenif key(1) then parse = parse .. "0" endif key(2) then parse = parse .. "." endif key(4) then parse = parse .. "-" endif key(6) then parse = parse .. "1" endif key(7) then parse = parse .. "2" endif key(8) then parse = parse .. "3" endif key(9) then parse = parse .. "+" endif key(10) then parse = parse .. "-" endif key(11) then parse = parse .. "4" endif key(12) then parse = parse .. "5" endif key(13) then parse = parse .. "6" endif key(14) then parse = parse .. "*" endif key(15) then parse = parse .. "/" endif key(16) then parse = parse .. "7" endif key(17) then parse = parse .. "8" endif key(18) then parse = parse .. "9" endif key(19) then parse = strsub(parse,1,#parse-1) endif key(33) then alpha = 1 end--alpha:elseif key(1) then parse = parse .. "z" endif key(2) then parse = parse .. " " endif key(3) then parse = parse .. [["]] endif key(6) then parse = parse .. "u" endif key(7) then parse = parse .. "v" endif key(8) then parse = parse .. "w" endif key(9) then parse = parse .. "x" endif key(10) then parse = parse .. "y" endif key(11) then parse = parse .. "p" endif key(12) then parse = parse .. "q" endif key(13) then parse = parse .. "r" endif key(14) then parse = parse .. "s" endif key(15) then parse = parse .. "t" endif key(16) then parse = parse .. "m" endif key(17) then parse = parse .. "n" endif key(18) then parse = parse .. "o" endif key(19) then parse = strsub(parse,1,#parse-1) endif key(21) then parse = parse .. "g" endif key(22) then parse = parse .. "h" endif key(23) then parse = parse .. "i" endif key(24) then parse = parse .. "j" endif key(25) then parse = parse .. "k" endif key(26) then parse = parse .. "l" endif key(27) then parse = parse .. "a" endif key(28) then parse = parse .. "b" endif key(29) then parse = parse .. "c" endif key(30) then parse = parse .. "d" endif key(31) then parse = parse .. "e" endif key(32) then parse = parse .. "f" endif key(34) then parse = parse .. "r" endif key(33) then alpha = 0 endendwait(2) --interruptuntil key(0)clear nilsetCursor(1,1)print(parse .. "_")refreshif key(5) then break end --check for EXEwait(3)endend
"welcome to the world of computers, where everything seems to be based on random number generators"
does it work with the classes now? sounds great, now you're sort of the inventor of classes for casio lollooks good, and it might be alpha-of-alpha, but you have to start somewhere.. i wish you good luck with it (not sarcastic or ironically meant xp )
if key(1) then parse = parse .. "0" endif key(2) then parse = parse .. "." endif key(4) then parse = parse .. "-" endetc etc
parsetable = {["1"]="0",["2"]=".",etc..}
parse..parsetable[tostring(key)]
does it work with the classes now? sounds great, now you're sort of the inventor of classes for casio lol
ooh, i just took a look at it, and can't you remake that Code: [Select]if key(1) then parse = parse .. "0" endif key(2) then parse = parse .. "." endif key(4) then parse = parse .. "-" endetc etcto a table like this:Code: [Select]parsetable = {["1"]="0",["2"]=".",etc..}or isn't that possible in luaFX? it would be a lot smaller than now, so you don't need all those statements, justCode: [Select]parse..parsetable[tostring(key)]
Quote from: Nick on January 05, 2012, 11:10:17 amdoes it work with the classes now? sounds great, now you're sort of the inventor of classes for casio lolJust for LuaFX! :pOW, 208 posts already?
Quote from: Eiyeron on January 05, 2012, 11:26:58 amQuote from: Nick on January 05, 2012, 11:10:17 amdoes it work with the classes now? sounds great, now you're sort of the inventor of classes for casio lolJust for LuaFX! :pOW, 208 posts already?What do you mean by "Just for LuaFX"?