Help with your scripting

Check Lua code for Scripting Errors

Check Lua code for Scripting Errors

Postby Shando » 15 Mar 2013, 22:35

Hi all,

Is there an easy way to check your code for incorrect use of Lua commands?

I'm having trouble running a Script where I am trying out some Lua stuff (similar to the csv import) and the Script just won't run at all. I have used sky.lprint in the onKeyDown function and it's not even getting that far (there's no other functions except my own and onKeyDown, which calls my function):

Code: Select all
function onKeyDown ( sKey )
   if ( sKey == "p" ) then
      sky.lprint ( "P key pressed")
      myFunc ( )
   end
end

function myFunc ( )
   sky.lprint ( "in myFunc")
   .....
   coding error
   somewhere here
   .....
end


I believe that there is a scripting error in myFunc ( ) that is stopping Skyline from running onKeyDown ( )??

I have tried using Lua's error trapping, but that doesn't seem to work either?

Look forward to your comments.

Regards

Shando
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Check Lua code for Scripting Errors

Postby SolarPortal » 15 Mar 2013, 23:13

if you could show the whole function, we should be able to help out.

There is'nt any compile error feedback as of yet.
Some errors are sent to the DOS console so it is always worth checking there :D
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Check Lua code for Scripting Errors

Postby Shando » 15 Mar 2013, 23:37

Hi SolarPortal,

Really I'm just messing around with Lua (refreshing my memory), so it could well be that I've used a deprecated command or something :oops:

I'll give the Lua 5.1 docs a read and see if I'm doing something silly before hassling you guys ;)

Regards

Shando
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer


Return to Lua Scripting

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron