Lunarovich Posted August 26, 2015 Share Posted August 26, 2015 When created, every entity script starts with a code like this: --[[ function Script:Start() end ]]-- --[[ function Script:UpdateWorld() end ]]-- --[[ function Script:UpdatePhysics() end ]]-- -- etc. Now, according to PIL, a common trick to comment out a block of code goes like this --[[ print(10) -- no action (comment) --]] If we add a hyphen to the first comment line, we get this: ---[[ print(10) --> 10 --]] Unfortunately, with a LE current default comment, we cannot do this. That's because the author of the default script was thinkng of Lua comments in the vein of C++ /* and */, which is, however, a wrong approach, since Lua comments do not function in that way. So, if you add a hyphen, you'll get this: ---[[ function Script:Start() end ]]-- --[[ function Script:UpdateWorld() end ]]-- --[[ function Script:UpdatePhysics() end ]]-- -- etc. and that's obviously unwanted and error-generating result, since Lua does not know what to do with ]] part of the ]]--. So, please correct this, so we can quickly comment out entity functions. Thanks. 2 Quote Link to comment Share on other sites More sharing options...
Thurnok Posted August 30, 2015 Share Posted August 30, 2015 You can actually do this yourself if you like. It's simply one of the template scripts. You can find it here: {your Leadwerks install dir}\Templates\Common\Scripts\Objects\Cameras\New script.lua This script is the template loaded when you click the "New\Script" popup menu item. NOTE: There is at least two other script templates that employ this erroneous convention (could be more, didn't really check all) - the other script in that same directory as above (3rdPersonFollow.lua) as well as the following: {your Leadwerks install dir}\Templates\Common\Scripts\AnimationManager.lua So if you want to correct all of them, you could use Notepad (or your favorite text editor) and do a search/replace on all the script template files for the occurance of "]]--" with "--]]". Quote Link to comment Share on other sites More sharing options...
Lunarovich Posted September 3, 2015 Author Share Posted September 3, 2015 Thanks. Will try it. Anyway, I would prefer that this be changed than to fiddle with search&replace everytime I start a new project... Quote Link to comment Share on other sites More sharing options...
Josh Posted September 3, 2015 Share Posted September 3, 2015 Whoa I had no idea you could do that. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Thurnok Posted September 3, 2015 Share Posted September 3, 2015 You don't have to do it "each" time. It's a one time thing. After you edit those entries, then Leadwerks simply copies them in to the data when you create a new project. You "might" have to modify them again after a Leadwerks update. Just depends on if it makes changes to the template files with a new upgrade. 1 Quote Link to comment Share on other sites More sharing options...
Thurnok Posted September 3, 2015 Share Posted September 3, 2015 Whoa I had no idea you could do that. Yea, its a pretty common thing with most development tools. Just about all of them have template files for things like "new project" or "comment insertion", etc. At least that's been my experience over my 36 years of development. For example, both Microsoft Visual C++ and Embarcadero RAD Studio have that feature. Many other product do as well, so its not surprising it can be done here too. Sometimes they are simply text files, other times XML, and sometimes proprietary but proprietary data files (DBs or otherwise) have become pretty unpopular with developers since we always want ways to make our job easier. LOL Game development is a new area for me, I'm used to building low level system tools, utilities, and other applications. Leadwerks appears to be a nice platform for wetting my appetite with game dev. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.