Add a prefix do var names on lua generators.

138 views
Skip to first unread message

Arthur G.

unread,
May 24, 2017, 10:49:38 AM5/24/17
to Blockly
Hello guys. 

I trying to add the prefix "local" before the name of any created variable with lua generator. I went through the .js file where the block VARIABLES is created and returns it´s code , and i tried this:



But, when i try to generate code from this, i get:







Transparency = 0 it´s ok, but it would be better to for me to have local Transparency = 0 


Any tips on how can i achieve this? 







Cory Diers

unread,
May 24, 2017, 12:57:47 PM5/24/17
to blo...@googlegroups.com
What generator file are you using in your app? My guess is that you're using lua_compressed.js as your generator, in which case, you need to rebuild your lua generator file after making changes. Two options - either use the raw generator files - so instead of:

<script src="...lua_compressed.js"></script>

You import

<script src="...generators/lua/variables.js></script>

(Note there are several files in this folder, you'll need to import every file that contains generators for blocks you're using, or build a new generators file that has all the blocks you need.)

OR, you can use the build script (build.py) to regenerate the compressed files. Assuming you're changing the files in generators/lua, this should pick up your changes and include them when you refresh the page.

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Cory Diers | Software Engineer | cory...@google.com | 

Arthur G.

unread,
Jul 10, 2017, 9:06:31 AM7/10/17
to blo...@googlegroups.com
Thanks very much! I will give it a try!




--
Cory Diers | Software Engineer | corydiers@google.com | 

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/VuG4yF5jJXA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+unsubscribe@googlegroups.com.

Arthur G.

unread,
Sep 22, 2017, 7:09:05 PM9/22/17
to blo...@googlegroups.com
So, it worked perfectly. 

I´m thinking about creating two kinds of blocks for lua variables:

one block to deal with local variables and another to deal with global variables. 

i´m trying to figure it out by messing around on the generantos>lua>variables.js 

but, if you could give any advice it would be great 

thank you again for helping with first issue 

2017-07-10 10:06 GMT-03:00 Arthur G. <arthur.g...@gmail.com>:
Thanks very much! I will give it a try!
2017-05-24 13:57 GMT-03:00 'Cory Diers' via Blockly <blo...@googlegroups.com>:
What generator file are you using in your app? My guess is that you're using lua_compressed.js as your generator, in which case, you need to rebuild your lua generator file after making changes. Two options - either use the raw generator files - so instead of:

<script src="...lua_compressed.js"></script>

You import

<script src="...generators/lua/variables.js></script>

(Note there are several files in this folder, you'll need to import every file that contains generators for blocks you're using, or build a new generators file that has all the blocks you need.)

OR, you can use the build script (build.py) to regenerate the compressed files. Assuming you're changing the files in generators/lua, this should pick up your changes and include them when you refresh the page.

On Wed, May 24, 2017 at 7:49 AM, Arthur G. <arthur.g...@gmail.com> wrote:
Hello guys. 

I trying to add the prefix "local" before the name of any created variable with lua generator. I went through the .js file where the block VARIABLES is created and returns it´s code , and i tried this:



But, when i try to generate code from this, i get:







Transparency = 0 it´s ok, but it would be better to for me to have local Transparency = 0 


Any tips on how can i achieve this? 







--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Cory Diers | Software Engineer | cory...@google.com | 

No0bSk1Walk3r

unread,
Jan 16, 2020, 5:09:45 PM1/16/20
to Blockly
Olá Arthur, queria saber se você conseguiu fazer os Blocos pra poder usar no Roblox, se você conseguiu fazer, eu iria te agradecer muito pq eu não sei NADA de programação e graças a vc eu poderei criar meus jogos no Roblox com ajuda dos Blocos, se vc conseguiu criar os blocos, vc poderia me passar o link POR FAVOR?
Ficaria muito agradecido!
Reply all
Reply to author
Forward
0 new messages