I'm trying to follow a Lua roguelike course to learn the language and by line 17 when I had attempted to run the program to see the title it came up with the error
lua: [string "<eval>"]:1: attempt to index global 'application' (a nil value)
stack traceback:
[string "<eval>"]:1: in main chunk
Here's all the code I've written and the link to the course
application:setOrientation(Application.LANDSCAPE_LEFT
application:setScaleMode("letterbox")
BLACK # 0x1A1A1A
application:setBackgroundColor(BLACK)
local fg = Bitmap.new(Texture.new("images/foreground.png", true))
fg:setX(1201)
stage:addChild(fg)
YELLOW # 0xDAD45E
local title = TextField.new(nil, "The Long Dark")
title:setTextColor(YELLOW)
title:setPosition(1320, 100)
stage:addChild(title)
https://programmingbymoonlight.com/roguelike-part-1-lua-and-gideros-an-introduction/
So I tried gideros and it worked properly, while it depends on lua it has it's own commands native to it's IDE framework.
Related
After upgrading my neovim to 0.7.2 I get the following error
Error detected while processing BufWinEnter Autocommands for "*":
E5108: Error executing lua ...pack/paqs/start/LuaSnip/lua/luasnip/loaders/from_lua.lua:97: attempt to call field 'get_load_fts' (a nil value)
stack traceback:
...pack/paqs/start/LuaSnip/lua/luasnip/loaders/from_lua.lua:97: in function '_load_lazy_loaded'
[string ":lua"]:1: in main chunk
E5108: Error executing lua [string ":lua"]:1: attempt to call field '_load_lazy_loaded' (a nil value)
stack traceback:
[string ":lua"]:1: in main chunk
E5108: Error executing lua [string ":lua"]:1: attempt to call field '_load_lazy_loaded' (a nil value)
stack traceback:
[string ":lua"]:1: in main chunk
Help on debugging very welcome!
The error was due to conflicting versions of the plugin, installed via two different plugin managers.
Looking into the different paths in the runtime path (as found with :set rtp) I found different installs and checked their "freshness" with git log.
I removed the folders related to the no longer used plugin manager.
The neovim config files did not really help, rather some lua and git command, but yes, the remark of #Icheylus is usually correct.
I am using lua to make scripts in my game,
after updating the lua libs version from 5.1 to 5.3, an error appears on the game engine every time I use
math.X in a function
error :
Lua run doFile failed.attempt to index a nil value (global 'math'))
original code :
local value = math.random(1,10)
do you have any solutions ?
I have been trying to run the following codes from Euler Equations Solver. It is a Lua script that I have been toying with using ZeroBrane Studio. But the project gave the following error every time I try to execute it.
attempt to index global 'Grid' (a nil value)
stack traceback:
...mming Codes\Project 1\Lua Script\Problem 1\Problem 1.lua:7: in main chunk
[C]: at 0x00401b00
I am completely new to Lua and I have been looking for the solutions everywhere. Appreciate any help that I can get.
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.
When I run a simple piece of code a = torch.Tensor(5,3) in ZeroBraneStudio, I receive the following error:
attempt to index global 'torch' (a nil value)
Does this mean that ZeroBraneStudio does not recognize Torch?
Make sure you select Torch as the interpreter (Project | Lua Interpreter | Torch-7) and configure the path to your th or luajit executable from torch (as described in this post).