Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 06-10-2017, 08:11 PM   #1
Airal
Banned
 
Join Date: Nov 2015
Posts: 406
Default Issue with Lua(table not found on some instances)

Sometimes when I run my script I get an error about a nil found of a table(the table isn't defined). This doesn't happen all the time and seems to be a reinitialization issue when the script is reran. It's quite a big script(it's a library)

Probably a difficult bug to produce. Once I get my script done I'll post it if the problem still occurs. Just mentioning it for now. BTW, why not luajit?
Airal is offline   Reply With Quote
Old 06-10-2017, 09:12 PM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Lua can sometimes be weird about whether or not a variable/table needs to have been defined earlier in the code or not. You could try defining that table as {} at the beginning of your code just so the table's name exists in memory.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 06-10-2017, 09:35 PM   #3
Airal
Banned
 
Join Date: Nov 2015
Posts: 406
Default

Yeah. I define everything before hand. The table exists. It's as if lua is not including the library that contains the table(sort of like your gui library, where every once in a while an error occurs that GUI is not defined... but of course it is)

It's not on my end because the code works fine about 95% of the time and if I just run the script consecutively, sometimes it fails with the main table not being defined... but of course it is.


my scripts go like

test.lua

require "library"

library.lua
lib = {}

but sometimes reaper complains and says lib is not defined.
Airal is offline   Reply With Quote
Old 06-11-2017, 12:20 PM   #4
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Can't say I've ever had that issue with my GUI library, or had anyone else mention it. However, I also don't use "require" because I hate the syntax... maybe there's something weird going on there?
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 06-11-2017, 03:35 PM   #5
Airal
Banned
 
Join Date: Nov 2015
Posts: 406
Default

I've never experienced the problem before but just started using lua(a few scripts) from python. It really seemed to start after I started using the gui and also notepad and my quick run key(so I can say in notepad to do most things). It's possible that maybe the save/run process I'm using is causing the problem. I'll look in to it. The error cold be deceiving.

Thanks, Great GUI btw!

Edit: I added a delay between the save and run and haven't had the error yet so it seems that it was that the lib file was being written to while it was being ran and this caused the strange error message.

Last edited by Airal; 06-11-2017 at 06:39 PM.
Airal is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.