Home › Forums › General › Programming › Advice before starting the project.
- This topic has 54 replies, 3 voices, and was last updated 12 years, 3 months ago by atom.
-
AuthorPosts
-
January 5, 2012 at 2:33 pm #3641
There might be more bugs like that in the LUA code, at first i wanted to use the String class but some problems occured with that and i had to fall back to std::string so there might be more stuff like that in the code, i’ll what i can find and post a build asap.
But the code there works, you just need to pass a String class as the parameters
[code:thzmr075]
f = utils.saveFileWindow (String("Save File"), File(""), String("*.syx"), true)
[/code:thzmr075]January 6, 2012 at 8:47 pm #3642As always, thank you.
functions you posted work well.To pass data to the file to be saved, the only method I’ve found is = ‘data: loadFromHexString ("f0 00 f7")’
other options?another question, but the functions table.insert, table.remove, table.sort etc. are not present?
Then when ready will post my work.
January 6, 2012 at 9:47 pm #3643I think the LUA native stuff should work so the string. table. math and others are there. If it’s not working let me know i’ll give it a check.
If you want to write something to the file you need to do it on the file object in your case
[code:1dpbf872]
f = utils.saveFileWindow (String("Save File"), File(""), String("*.syx"), true)
if f:existsAsFile() then
f:replaceFileContentWithData(data)
end
[/code:1dpbf872]
Other file methods are described here http://www.rawmaterialsoftware.com/juce … sFile.html like i wrote on the API Docs page, api/class_ctrlr_lua_file.html#af5b2054af101fc9bd1663c40a9e71b5fJanuary 7, 2012 at 12:53 pm #3644atom I confirm that I was unable to have the ability to manage the table, with the functions sort, insert, and so on.
I take this opportunity to ask another question:
how to prevent a lua function is executed when you start the application?
I have assigned the lua function to the modulator, it is immediately executed when the application starts.January 7, 2012 at 1:30 pm #3645It will always execute since at the start the modulator needs to have an assigned value and that causes the LUA method to execute (since it’s linked to the modulator value changed event).
January 7, 2012 at 2:23 pm #3646Create a method and put it on the panel option "Called before any modulators are created". In this method set a variable (p.e. [i:5n4tuo9b]panelLoaded = 0[/i:5n4tuo9b])
Put this variable at the beginning of the method , and if the variable is true the method is executed, otherwise not.
[i:5n4tuo9b]
—
— Called when a modulator value changes
—
method = function(modulator, newValue)
If panelLoaded = 1 then
method
end[/i:5n4tuo9b]Then you can set to true this variable when you need it, may be when the panel has finished loading or at the press of a button, and from this moment the method will be executed when the modulator is called.
January 7, 2012 at 4:57 pm #3647@dasfaker
thanks, it works
I had not thought about this possibility.January 9, 2012 at 10:34 am #3648Hi Atom
When I try to open a file and the open file window pop up, pressing Cancel (so I don’t open any file) crash Ctrlr. Otherwise works fine.
I’m using the code you posted here
[code:2nbn7olf]f = utils.openFileWindow ("open file", File(""), "*.*", true)
data = f:loadFileAsData()
— data is a CtrlrLuaMemoryBlock with the contents of the file
console (data:toHexString(1))[/code:2nbn7olf]January 9, 2012 at 2:13 pm #3649this code works well for me, even if I press cancel,
but the large files, passed to the console output, freeze CTRLR.
instead seems to load fine without assigning them to the console output.
buffer console too small?January 9, 2012 at 7:36 pm #3650Well i don’t think that printing loads of data to the console is a good idea it’s a simple component that console.
As for the crash i know why it’s happening you get and invalid file and trying to write to it so that will crash, always check if the file is valid and writable before writing to it.
January 11, 2012 at 2:10 pm #3651"Tronic":25ajj46r wrote:I was unable to have the ability to manage the table, with the functions sort, insert, and so on.
[/quote:25ajj46r]
added this to bug list [LINK][/url:25ajj46r]January 11, 2012 at 4:47 pm #3652I don’t see the problem it works for me in the console
[code:2sh0hyyp]
>>> t = { 3,2,5,1,4 }>>> table.sort (t, function(a,b) return a<b end)
>>> console (table.concat(t, ", "))
1, 2, 3, 4, 5
[/code:2sh0hyyp]January 11, 2012 at 5:28 pm #3653This is the error I get
[code:vcbxvife]ERROR: [string "t = { 3,2,5,1,4 }..."]:2: attempt to call field ‘sort’ (a nil value)[/code:vcbxvife]maybe I forgot to specify that I use the WINDOWS version
tested on both the 32bit and the 64bitJanuary 11, 2012 at 6:55 pm #3654it doesn’t matter what version/os you use LUA is the same. Can you paste the code you are typing in ?
January 11, 2012 at 6:59 pm #3655this or as your I get this
[code:1zh8ch0v]>>> t = { 3,2,5,1,4 }
table.sort (t, function(a,b) return a<b end)
console (table.concat(t, ", "))
ERROR: [string "t = { 3,2,5,1,4 }..."]:2: attempt to call field ‘sort’ (a nil value)[/code:1zh8ch0v]January 11, 2012 at 7:07 pm #3656I don’t know how can this not work, i typed this in the console, either in per-line or as a whole and it works, and i’m also on windows7 x64
[code:3gqsks4i]>>> t = { 3,2,5,1,4 }
>>> table.sort (t, function(a,b) return a<b end)
>>> console (table.concat(t, ", "))
1, 2, 3, 4, 5>>> t = { 3,2,5,1,4 }
table.sort (t, function(a,b) return a<b end)
console (table.concat(t, ", "))
1, 2, 3, 4, 5
[/code:3gqsks4i]January 11, 2012 at 7:11 pm #3657It’s working here on Win XP, rev 919
January 11, 2012 at 7:19 pm #3658” title=”Sad” />
I’m on Win7 x64ideas about what I could do to understand why it does not work on my system?
January 11, 2012 at 8:02 pm #3659I have no idea, this does not depend on the OS LUA is built into the Ctrlr binary.
January 11, 2012 at 8:31 pm #3660possible dependence of some framework 3.5 or 4?
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.