View unanswered posts | View active topics It is currently Sat Aug 24, 2019 8:16 am



Reply to topic  [ 2 posts ] 
 Debugging attached Lua scripts the easier way 
Author Message
DRL Developer
DRL Developer
User avatar

Joined: Thu Jun 11, 2009 2:34 pm
Posts: 965
Reply with quote
Post Debugging attached Lua scripts the easier way
Excuse me if I'm going to say something well known or stupid :)

I was annoyed that I need to reload CC every time I want to change Lua script attached to device, so I wrote a little workaround:

INI file:
Code:
ScriptPath = UnmappedLands.rte/Scenes/Objects/Teleport/TeleportDebug.lua


TeleportDebug.lua, a stub used only while you're debugging. CF_PutTeleport() is a function which actually does something useful
Code:
function Create(self)
   print ("TeleportDebug")
   dofile("UnmappedLands.rte/Scenes/Objects/Teleport/Teleport.lua")
   CF_PutTeleport(self);
end


Teleport.lua, actual script in which you write you code, replace your debug stub with it in INI once everything's fine.
Code:
function Create(self)
   CF_PutTeleport(self);
end

function CF_PutTeleport(self)
   print ("Change Places!");
end


This way your code is reinterpreted EVERY TIME your script runs, not a single time when it loads when CC starts :)


Tue Sep 27, 2011 7:39 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Debugging attached Lua scripts the easier way
Or failing that, open the console and type:
Code:
PresetMan:ReloadAllScripts()


But your way works too.


Tue Sep 27, 2011 8:06 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.016s | 14 Queries | GZIP : Off ]