I have imported to my MediaWiki site the it.Wikipedia Modulo:Bio but I get this error:
Error Lua in Module:Bio line 700: attempt to index field 'wikibase' (a nil value).
In line 700 I have this code:
local entity = mw.wikibase.getEntityObject()
I have multiple wikis that shares the same source code, and the same database, but with its own tables. Then my wikibase is mybase.mywiki.com.
I tried to solve by changing wikibase to mybase:
local entity = mw.mybase.getEntityObject()
But it doesn't work.
The problem is not wikibase: the error simply says that there is no field named wikibase in the mw table, so the problem is that mw doesn't contain what you think it should. You must find the code that puts wikibase field in mw. If it does something like mw.wikibase = something and something is nil, then it is as if that line had not executed (it is not an error to assign nil to a table field, it is like removing the field if it exists already, and doing nothing if it doesn't exist). This is common error when something is an function call, the function may return nil under some circumstances.
Related
TxAdmin Log
Server.lua file
I have try'd to change the nummbers but I think in the Database is something wrong
You're attempting to index result a nil value in line 170 of server.lua.
result is nil in this scope you you cannot do this result[0].
Either find out why result is nil and fix it or avoid indexing it if it is .
Your code suggests that you failed to assign the return value of your SQL query to a variable.
So try
local result = MySQL.Asynch.fetchAll("...
Still you should checker whether your query actually returned a result using a conditional statement or assertion.
I'm using this (old) Lua module to save and access tables from local files (if there is a better way, please shout I'm not invested) -- https://github.com/gideros/table.save/blob/master/table.save-0.94.lua
It's been working great, but now I'm trying to save key value pairs I'm getting the error:
attempt to call global exportstring (a nil value)
I'm new to Lua. The error is on line 108 on that file I linked to. Any ideas?
I've tried creating blank tables, or basic tables without key value pairs, this works fine. It's when I come to insert strings the issues arise.
This will work:
local myTable = {}
myTable[0] = 2
inputOutputTable.save(myTable, "testytesty")
local testy = inputOutputTable.load("testytesty")
print("Testing 123... " .. testy[0])
However this wont:
local myTable = {}
myTable["welcome"] = "1"
I get : attempt to call global 'exportstring' (a nil value)
Expected results - it saves the table.
What happens - it throws the error.
Using the code:
function createNewBody(name,mass)
if not world.body[name]==nil then
print("This body has already been created. Maybe you meant to update it's values?\n")
else
world.body[name]={mass=m,x=0,y=0,xAccel=0,yAccel=0,xR=0,yR=0,properties={gaseous=false,texture=""}}
world.bodies=world.bodies+1
end
end
This code shows no errors, but when I bind createNewBody(moon,1.622) to a key and then use it, it lets me spam the key without showing the error message.
And, yes, I have defined world.bodies and world.body
not world.body[name]==nil is parsed as (not world.body[name])==nil. Since the result of not is a boolean, it is never nil.
Try not(world.body[name]==nil) or world.body[name]~=nil.
When I insert the following code (into LÖVE's engine)
function createNewBody(id,m)
if world.attributes.isCreated==true then
world.body[id]={mass=m,x=0,y=0,xAccel=0,yAccel=0,xR=0,yR=0} --error is in this line.
world.bodies=world.bodies+1
else
print("You must first create a new world!\n")
end
end
And calling it by: createNewBody(moon,physics.math.moonG) (yes, I have already defined moonG).
Here is my physics.math table:
physics={}
physics.math={
gUnit="m/s^2",
earthG=9.80665,
moonG=1.622,
marsG=3.711,
mercG=3.7,
jupitG=24.79,
pi=3.14159265359,
ln=2.718281828459
}
I get the following error: 'table index is nil'
I'm not sure what I am doing wrong.
You can't create a table this way.
First, you have to create an empty table by the following:
world.body[id] = {}
And then, you can upload it with key-value pairs:
world.body[id].mass = m
world.body[id].x = 0
world.body[id].y = 0
...
Maybe you can write them in the same fashion you did in the original code; I'm not sure if that works, but likely does.
Bonus: by creating a "template table" and usingipairs search, you can make it even more simple, but that's out of the scope of this question.
Logs --
16:12:35 Lua Error: [ERROR] addons/tttdamagelogs-master/lua/rdm_manager/sv_rdm_manager.lua:472: attempt to index field 'database' (a nil value)
Code which starts at line 471 --
local encoded = util.TableToJSON(tbl)
local update = Damagelog.database:query("UPDATE damagelog_previousreports SET report = "..sql.SQLStr(encoded).." WHERE _index = "..tbl.index..";")
update:start()
I am wondering why I am receiving the error as stated above, referencing to line 472? Thanks
Because Damagelog does not contain a key named database. Most likely cause is a typo, for example perhaps it should be damagelog or DamageLog (Lua names are case sensitive).