Author Topic: CalGUI -- A GUI library by flyingfisch  (Read 27635 times)

0 Members and 1 Guest are viewing this topic.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #60 on: January 06, 2012, 10:33:16 am »
LuaFX is almost exactly the same as lua 5.1. I guess you could make it event based somehow...But yeah, I think you have to do loops

« Last Edit: January 06, 2012, 10:33:46 am by flyingfisch »



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #61 on: January 06, 2012, 11:05:07 am »
Bug report!

After procrastinating for a day, i decided to test the lua classes code with this program:

Code: [Select]
local print = graydraw.print

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 derived
end

car = class()

function car: init(power, type, lights, etc)
    self.power = power
    self.type = type
    self.lights = lights*2
    self.options = etc
end

jeep = car(60, "4x4", 12, {air-conditioning = False, trailer-hook = True})

if jeep.options.trailer-hook then
   print("The jeep can have a trailer")
else
   print("No trailer for you :(")
end

And....I get an error:

Code: [Select]
[string 'experiment.lua']:35: '}' expected near '='

So is there a problem with my code, luaFX, or the lua class code?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #62 on: January 06, 2012, 11:06:34 am »
try to remove the spaces, and if that does not work, place quotation mark around the air-conditioning and if that doe not work place [" "] around ari conditioning and if that does not work you're lost xp

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #63 on: January 06, 2012, 11:16:45 am »
Well, apparently it did not like the dashes. But now I get another error with this code D:

Code: [Select]
local print = graydraw.print

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 derived
end

car = class()

function car: init(power, type, lights, etc)
    self.power = power
    self.type = type
    self.lights = lights*2
    self.options = etc
end

jeep = car(60, "4x4", 12, {airconditioning = false,trailerhook = true})
if jeep.trailerhook then
   print("The jeep can have a trailer")
else
   print("No trailer for you :(")
end

Error message:

Code: [Select]
[string 'experiment.lua']:22: Attempt to call global 'setmetatable', a nil value
« Last Edit: January 06, 2012, 11:17:01 am by flyingfisch »



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #64 on: January 06, 2012, 11:23:03 am »
maybe its something with LuaFX...
the way you used setmetatable works on oclua...
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #65 on: January 06, 2012, 11:26:25 am »
oclua?



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: CalGUI -- A GUI library by flyingfisch
« Reply #66 on: January 06, 2012, 11:37:20 am »
o_O

setmetatable() is a native lua function ....
:o

( http://lua-users.org/wiki/MetamethodsTutorial )

What version of Lua are you using ?
That may be the problem...

Also, I know there are some encoding problem with Omnimaga codes in posts.

Here's the class function, that you can again copy/paste, maybe it will work this time ?
http://pastebin.com/9gTmaKKK
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #67 on: January 06, 2012, 11:42:27 am »
I guess this is why luaFX is called beta right now. :P

I'll have to ask eiyeron to talk to veb about it for me. :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #68 on: January 06, 2012, 11:59:22 am »
oclua is the nspire on-calc lua programming stuff
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #69 on: January 06, 2012, 12:01:08 pm »
Oh, ok. So On-Calc lua. ok :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #70 on: January 06, 2012, 12:09:03 pm »
well, flyingfisch, don't feel like making one too? could be very useful..

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #71 on: January 06, 2012, 12:29:54 pm »
well, flyingfisch, don't feel like making one too? could be very useful..

On-calc lua editor? Yeah, I think I'll try that when I learn C/C++. Which I should probably do pretty soon. :P

Which language do you think I should learn? C or C++? They both make addins.



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: CalGUI -- A GUI library by flyingfisch
« Reply #72 on: January 06, 2012, 12:31:25 pm »
i asked myself that question too, most people say C++, dunno why, but it's true..

btw: i don't know the difference..
« Last Edit: January 06, 2012, 12:31:42 pm by Nick »

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: CalGUI -- A GUI library by flyingfisch
« Reply #73 on: January 06, 2012, 12:35:46 pm »
i asked myself that question too, most people say C++, dunno why, but it's true..

btw: i don't know the difference..

neither do I :D

I think I'll just stick with lua and make the on-calc editor in lua when we get the ability to write programs from a lua file. ;)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: CalGUI -- A GUI library by flyingfisch
« Reply #74 on: January 06, 2012, 01:07:08 pm »
I am doing both :)
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads