Why am i getting this run time error in lua of bad argument #-1 to '_newindex' (string expected, got nil) - lua

I was configuring the transparency in my rc.lua file for my awesome wm. I am now getting the error mentioned in the title. I have since opened up my original rc.lua thats located in /etc/xdg/awesome/rc.lua and made it exactly the same, yet i still get this error. Any thoughts?
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)

I got the Error when installing a new Theme, but I guess it could be the same problem.
The two mentioned lines are perfectly fine, the error message is misleading!! The problem was (in my configuration at least) a wrong path to my theme file:
# This was the original line:
# beautiful.init("~/.config/awesome/themes/Darklooks/")
# and now the working full path to my theme file:
beautiful.init("~/.config/awesome/themes/Darklooks/theme.lua")

Related

The type provider 'ProviderImplementation.JsonProvider' reported an error despite program working

I am writing a service using .net Core with Visual Studio 2017. I want to use JSON for the configuration, so I defined my type like this:
type ServiceConfig = JsonProvider<"exampleConfig.json", EmbeddedResource="MyService, exampleConfig.json", SampleIsList = true>
In my program, I load it like this:
let conf = ServiceConfig.Load "config.json"
When I run it, it works fine, but in VS 2017 I get a red squiggly line and the error log says:
FS3033 The type provider 'ProviderImplementation.JsonProvider'
reported an error in the context of provided type
'FSharp.Data.JsonProvider,Sample="exampleConfig.json",SampleIsList="True",EmbeddedResource="MyService, exampleConfig.json"', member 'Load'. The error: Method
'FSharp.Data.Runtime.BaseTypes.IJsonDocument
Create(System.IO.TextReader, System.String)' not found in type
''. This method may be missing in the types available in the
target assemblies.
How do I get rid of this?
I'm not sure that this is the problem, but it might help to give an absolute path of the sample file. Resolving a relative path is a constant source of issues in type providers. You can do something like:
[<Literal>]
let sample = __SOURCE_DIRECTORY__ + "/exampleConfig.json"
type ServiceConfig =
JsonProvider< sample, EmbeddedResource="MyService, e
xampleConfig.json", SampleIsList = true >
By chance I found the answer myself. It must have been some Visual Studio index having gone wonky. I had another problem with another project in my solution so I just did an "emergency commit" to git, cleaned my local working copy using git clean -fdx and then reloaded the solution, rebuilt everything and the errors went away.

lua lfs on flashair w04 seems not to work

Hi for the last week i have been trying to get my Flashair to upload its files over ftp.
I can make a ftp connection without any problems, but when i try to iterate over the files in its folder its gives me a error on the lua lfs, the only thing its returning is nil.
its goes about this code sample:
for file in lfs.dir(localDir) do
attr = lfs.attributes(localDir .. file)
print( "Found "..attr.mode..": " .. file )
if attr.mode == "file" then
response = fa.ftp("put", ftpString..file, localDir .. file)
if response ~= nil then
print("Success!")
else
print("Fail!")
end
end
end
the error i get is:
lua: ftp.lua:17: attempt to index a nil value (global 'lfs')
stack traceback:
ftp.lua:17: in main chunk
[C]: in ?
where line 17 is the first line in the provided code sample.
Am I missing something, seems that i cannot find a lot information about this problem in combination with the Flashair.
Any help would be appreciated.
I am new to Lua so don't flame me if my response is not beneficial to you. I have been developing an app for W-03 and when testing the Lua app on my MACBOOK linux virtual env I was seeing the same error, and discovered I had to use require "lfs" statement in my test code. require "lfs" is not necessary when running on the actual W-03 though.

Why does Corona give an error loading code that loads fine with lua?

I'm having problems with a specific line of code - building.transmitter:[operation](player, unpack({...})) that causes an error in Corona, yet this loads fine when it's run in Lua separately. I suspect it has something to do with the : being placed before the [operation] variable but I'm clueless why.
Specifically the module is written as,
local activate = {}
local function activate.transmitter(player, operation, ...)
building = player:getTile()
building.transmitter:[operation](player, unpack({...}))
end
return activate
The runtime errror that is appearing gives me
"error loading module from file, '<name>' expected near '['"
Edit - WOW! I didn't notice that when troubleshooting this in Corona I changed some of the lines of code to identify the problem. I then mistakenly tested the edited code in Lua and it ran fine. I didn't realize the code wasn't the original until siffiejoe pointed out the interpreter getting an error as well. Sorry for the mistake.
maybe Corona uses older version of Lua which does not support this syntax. You can try workaround instead of
building.transmitter:[operation](player, unpack({...}));
you can call
building.transmitter[operation](building.transmitter, player, unpack({...}));

Emacs css-mode not loading

I'm not sure why, but on my Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.8.4) css-mode is not loading and with M-x css-mode gives this error in Messages:
Symbol's function definition is void: apropos-macrop
or
File mode specification error: (void-function apropos-macrop)
my css file (ending in .css) is in Fundamental. I just tried it on a 23.1.1 and CSS mode comes up and works fine.
Update: Traced problem to my autoloads. i.e., comment out autoloads
;(load "~/modes/autoloads" 'install)
and the problem goes away. I'm not sure what to hack with an autoloads file. Any way to "step" through an autoloads? Here's my autoloads: http://gmcongo.org/temp/autoloads
In Emacs 24.4 and the bleeding edge versions leading to it (like 24.3.50+), apropos-macrop has been replaced by macrop. In css-mode.el, replace the call to apropos-macrop with a call to macrop and the error goes away.
Building upon the existing correct answer, you can create an alias in your ~/.emacs instead of editing css-mode (if for example, it came in a package with your distribution):
;; For css-mode, temporarily.
(defalias 'apropos-macrop 'macrop)

lua lxp The specified module could not be found

I'm putting together an application that uses the moon soap, but when you run it reports the following error :
C:\Lua\5.1\lua.exe: error loading module 'lxp' from file 'C:\Lua\5.1\clibs\lxp.dll':
The specified module could not be found.
How do I fix this ?
This is not a "file not found" error. Note that the message stated that it tried to load the module "lxp" from a file ('C:\Lua\5.1\clibs\lxp.dll') but it didn't work. Maybe the file doesn't have a luaopen_lxp C function (which might be called by loadlib)... Or maybe you are not loading it with require...

Resources