Hi All,
I updated ZeroBrane Studio Love API for 0.9.0; thanks to Santos for keeping his love_api.lua script up-to-date. This update will be included in the next version of ZBS (0.41), but those who want to use it right now, can grab the current version from github; as an alternative, you can update api/lua/love2d.lua file in your installation to use the new API. The updated API is used for both auto-complete and tooltips with descriptions. Please let me know if you notice any issues with the update.
Paul.
ZeroBrane Studio Love API updated for 0.9.0
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
Re: ZeroBrane Studio Love API updated for 0.9.0
Thanks! The auto - completion does work great so far.
But still it looks like the Scratchpad feature ( changing variables while the program is running ) doesn't work for me with the GitHub version.
Anything I need to know about that ? The video make it look like I didn't have to prepare my code in any form for that.
Happy Holidays.
But still it looks like the Scratchpad feature ( changing variables while the program is running ) doesn't work for me with the GitHub version.
Anything I need to know about that ? The video make it look like I didn't have to prepare my code in any form for that.
Happy Holidays.
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
Re: ZeroBrane Studio Love API updated for 0.9.0
Hi MadByte,
> But still it looks like the Scratchpad feature ( changing variables while the program is running ) doesn't work for me with the GitHub version.
> Anything I need to know about that ? The video make it look like I didn't have to prepare my code in any form for that.
I tested with the current version of Love and with the latest version of ZBS (the one you are using) and the scratchpad appearsto be working as expected. You may need to re-structure your code a bit as only changes to global variables are going to be "noted"; you are not limited to just variable changes and can change anything in your code, but only changes to functions called from draw() and update() functions will be visible.
I suggest you look at love2d samples that ship with ZeroBrane Studio (they are also available as ZeroBrane EduPack); for example, "ZeroBraneEduPack/love2d-samples/trajectory" example includes lovedraw and loveupdate functions and any changes to those functions will be seen immediately when running as scratchpad.
> But still it looks like the Scratchpad feature ( changing variables while the program is running ) doesn't work for me with the GitHub version.
> Anything I need to know about that ? The video make it look like I didn't have to prepare my code in any form for that.
I tested with the current version of Love and with the latest version of ZBS (the one you are using) and the scratchpad appearsto be working as expected. You may need to re-structure your code a bit as only changes to global variables are going to be "noted"; you are not limited to just variable changes and can change anything in your code, but only changes to functions called from draw() and update() functions will be visible.
I suggest you look at love2d samples that ship with ZeroBrane Studio (they are also available as ZeroBrane EduPack); for example, "ZeroBraneEduPack/love2d-samples/trajectory" example includes lovedraw and loveupdate functions and any changes to those functions will be seen immediately when running as scratchpad.
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
Re: ZeroBrane Studio Love API updated for 0.9.0
@MadByte, did you get the scratchpad working for you?
Re: ZeroBrane Studio Love API updated for 0.9.0
No, I tried it with your trajectory demo ( I had to change one small thing [ arg to ... ; local arg = {...} ]) but even with this one it does not work the way you showed it in your video. If needed I make a video showing my steps, but I'm pretty sure I do it right.
Is there any additional software I have to install to make it work?
Is there any additional software I have to install to make it work?
Re: ZeroBrane Studio Love API updated for 0.9.0
Hi,
if your changes refer to
then this shouldn't be changed, because the "new" arg is for storing commandline parameters, and in this case it is not the "old version" of ...
if your changes refer to
Code: Select all
function love.load(arg)
if arg and arg[#arg] == "-debug" then require("mobdebug").start() end
end
Re: ZeroBrane Studio Love API updated for 0.9.0
Thanks for clearing that up.riidom wrote:Hi,
if your changes refer tothen this shouldn't be changed, because the "new" arg is for storing commandline parameters, and in this case it is not the "old version" of ...Code: Select all
function love.load(arg) if arg and arg[#arg] == "-debug" then require("mobdebug").start() end end
My problem is, without changing arg to ... the whole program freezes for me and I have to close it using the windows task manager. I don't know what exactly the problem is and to be honest I'm a bit confused by these "arg / ..." stuff. So, what can causes the freezing for me ?
- slime
- Solid Snayke
- Posts: 3170
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: ZeroBrane Studio Love API updated for 0.9.0
"arg" is a global table which holds the command-line arguments given to LÖVE when it was launched.MadByte wrote:I'm a bit confused by these "arg / ..." stuff.
"..." is the vararg expression: it's used for a variable amount of arguments. You can use it like this:
Code: Select all
function foo(...)
local a, b = ...
return a + b
end
function bar(baz, ...)
local t = {...}
print(#t)
return baz
end
print(foo(3, 4))
x = bar(10, "a", "b", "c", "d")
Unfortunately the official online version of the Programming in Lua book is the first edition which was written for Lua 5.0, so it contains outdated information on this topic.
Re: ZeroBrane Studio Love API updated for 0.9.0
Thanks slime.
I got it working now. I realized that this demo obviously won't run in normal mode and causes the window to freeze. When running it in scratchpad mode it does work and I can see the live changes.
I got it working now. I realized that this demo obviously won't run in normal mode and causes the window to freeze. When running it in scratchpad mode it does work and I can see the live changes.
-
- Party member
- Posts: 227
- Joined: Thu Jun 28, 2012 8:46 pm
Re: ZeroBrane Studio Love API updated for 0.9.0
MadByte,
> I got it working now. I realized that this demo obviously won't run in normal mode and causes the window to freeze.
> When running it in scratchpad mode it does work and I can see the live changes.
Glad you got it working. It should work the same way in normal mode and in scratchpad because "arg" in this case is a local parameter for love.load (which indeed gets the parameters passed from the command line).
One reason why it may freeze is that conf.lua for that project uses c.screen instead of c.window (as it's now called in 0.9.0), which causes a run-time error. I already made the change in the example, but noticed it too late for it to be packaged with ZBS 0.40. The current code in conf.lua looks like this:
> I got it working now. I realized that this demo obviously won't run in normal mode and causes the window to freeze.
> When running it in scratchpad mode it does work and I can see the live changes.
Glad you got it working. It should work the same way in normal mode and in scratchpad because "arg" in this case is a local parameter for love.load (which indeed gets the parameters passed from the command line).
One reason why it may freeze is that conf.lua for that project uses c.screen instead of c.window (as it's now called in 0.9.0), which causes a run-time error. I already made the change in the example, but noticed it too late for it to be packaged with ZBS 0.40. The current code in conf.lua looks like this:
Code: Select all
function love.conf(c)
c.title = "Trajectory"
local window = c.screen or c.window -- love 0.9 renamed "screen" to "window"
window.width = 1024
window.height = 660
end
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests