Author Topic: Updating WZGUILib  (Read 158689 times)

0 Members and 3 Guests are viewing this topic.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #345 on: August 16, 2013, 09:43:11 am »
Basically when you press the enter key while using the console, it packages everything sent into a table. In this case the third value in the table will be the function name, and the fourth value in the table will be the other arguments.
Code: [Select]
           
for i = 5, #bt do
   bt[4] = bt[4]..", "..bt[i]
end
local fCall = assert(loadstring(bt[3].."("..bt[4]..")"))
a, b = fCall()
self:addHistoryEntry("Returned: "..tostring(a).." and "..tostring(b))
<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 Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Updating WZGUILib
« Reply #346 on: August 16, 2013, 10:52:59 am »
Let us analyse your code a bit to identify the problem. First let's replace bt[3] by 'myfunc' and bt[4] by 'params'.
That would give us the following code:

Code: [Select]
local fCall = assert(loadstring(myfunc.."("..params..")"))
a, b = fCall()
self:addHistoryEntry("Returned: "..tostring(a).." and "..tostring(b))

Now, what does loadstring do? Create a chunk from the given data. Basically, create a function with the contents that you pass to loadstring. So if we evaluate what actually happens, we get something like this:
Code: [Select]
function fCall()
   myfunc(params)
end

As you can see, the function will never return anything because it doesn't contain a return statement. So there is your problem ;)

Now, about the code itself, do not use loadstring for this. It will significantly slow down your script. Rather do something like this:
Code: [Select]
local params = {}
for i = 4, #bt do
   table.insert(params, bt[i])
end
local myfunc = _G[bt[3]] -- if it's a global function that is
a, b = myfunc(unpack(params))
self:addHistoryEntry("Returned: "..tostring(a).." and "..tostring(b))

Now, this is code for the situation that you have now. If possible, just pass the function as a reference, not as a string. Then put all the parameters in a table so that you don't need to copy them in a new one. Something like this:
{data, data, functionreference, {param1, param2}}
Then you could do a, b = bt[3](unpack(bt[4]))
« Last Edit: August 16, 2013, 10:56:13 am by Jim Bauwens »

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #347 on: September 26, 2013, 08:20:36 am »
Sorry for my silence for the last month, I just started college and it has been hectic! I haven't gotten a lot done, but I have been working on this project periodically.
<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 jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #348 on: September 28, 2013, 11:22:27 pm »
With this update, I corrected the call system on the console.
<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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Updating WZGUILib
« Reply #349 on: September 28, 2013, 11:22:57 pm »
Glad to see you are still working on this :)

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #350 on: October 16, 2013, 10:24:02 pm »
Here is a partial example program that I was working on for physics, but unfortunately never finished before the test  :P
It displays several important things that can be done with WZ such as encapsulating forms with all of their objects into classes and event binding.
It also shows my bad graphics drawing abilities  :P
<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 jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #351 on: November 20, 2013, 12:05:44 pm »
So I upgraded from 8.1 preview to 8.1 and am working on getting a new license, should be back up and developing soon.
<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 jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #352 on: January 05, 2014, 01:25:12 pm »
I got my license and will be resuming development. During my break I have been working on improving my C skills and am really considering porting everything to C. By keeping all of the WZ definitions abstract this project would be very portable and would allow way more flexibility. I guess we will see what happens when the time comes. Until then I need to finish up my documentation before classes resume so maybe expect something by the end of next week? I am a slave to my schedule so I will see how it goes.
<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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Re: Updating WZGUILib
« Reply #353 on: January 05, 2014, 01:57:11 pm »
Glad to hear. Hopefully you can have more free time soon, too. :)

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: Updating WZGUILib
« Reply #354 on: January 05, 2014, 03:33:23 pm »
can't wait for the PRIZM version, I have a project I would like to do but I need WZGUILIB. ;)



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: Updating WZGUILib
« Reply #355 on: January 06, 2014, 11:00:43 am »
I really want to make a prizm version, but has anything happened with LuaZM? I think it was stable enough to port WZ so It will be the next thing on my list.
<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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Re: Updating WZGUILib
« Reply #356 on: January 06, 2014, 11:45:09 am »
I think. LuaZM should be fine enough, but I guess Flyingfisch and Kerm would need to confirm.

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #357 on: January 06, 2014, 01:07:15 pm »
I think when I looked into it, I thought it was also fine. I will have to do so again soon.
<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 jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: Updating WZGUILib
« Reply #358 on: January 07, 2014, 09:49:22 am »
So Last night I did a little bit of messing around with the button drawing code and came up with this. Which of the three do you like better?
<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 DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Updating WZGUILib
« Reply #359 on: January 07, 2014, 11:21:01 am »
I prefer the New 1 button.