Attempt to call global (a nil value) - when saving tables to a file with LuaLua : How to check if one of the values associated with the specified key of a table is nil, from apiAttempt to index global 'front' (a nil value)Lua 5.2 issue: 'attempt to call a nil value' from lua_pcallWhy attempt to index global (a nil value) Lua?Attempt to index local 'file' (a nil value) at file:writeCannot import module with Lua, results in attempt to index global 'test' (a nil value)attempt to index global 'ent' (a nil value)Attempt to call field 'registersave' (a nil value)In Lua, how to call a function stored inside a table using the table index?LUA attempt to index global nil value

Would the Republic of Ireland and Northern Ireland be interested in reuniting?

Murderer's Gloves, which book is it from?

Is there any way white can win?

Can a Rogue PC teach an NPC to perform Sneak Attack?

How to determine car loan length as a function of how long I plan to keep a car

Maps between grassmannians with inclusion property

Why are non-collision-resistant hash functions considered insecure for signing self-generated information

What to say to a student who has failed?

What is the difference between "Grippe" and "Männergrippe"?

How do the Etherealness and Banishment spells interact?

Is "The life is beautiful" incorrect or just very non-idiomatic?

Would it be possible to have a GMO that produces chocolate?

tar using short form option versus old style

Why do all fields in a QFT transform like *irreducible* representations of some group?

How to prevent clipped screen edges on my TV, HDMI-connected?

French abbreviation for comparing two items ("vs")

Localization at a multiplicative set is a localization at a prime ideal if local

What is this symbol: semicircles facing each other?

Why is 1. d4 Nf6 2. c4 e6 3. Bg5 almost never played?

Problem when including a foreach loop

Did a flight controller ever answer Flight with a no-go?

Why do gliders have bungee cords in the control systems and what do they do? Are they on all control surfaces? What about ultralights?

How many String objects would be created when concatenating multiple Strings?

Transposing from C to Cm?



Attempt to call global (a nil value) - when saving tables to a file with Lua


Lua : How to check if one of the values associated with the specified key of a table is nil, from apiAttempt to index global 'front' (a nil value)Lua 5.2 issue: 'attempt to call a nil value' from lua_pcallWhy attempt to index global (a nil value) Lua?Attempt to index local 'file' (a nil value) at file:writeCannot import module with Lua, results in attempt to index global 'test' (a nil value)attempt to index global 'ent' (a nil value)Attempt to call field 'registersave' (a nil value)In Lua, how to call a function stored inside a table using the table index?LUA attempt to index global nil value






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















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.










share|improve this question


























  • I see "Lua 5.1 compatible" on that github page. What is your Lua version?

    – glenn jackman
    Mar 27 at 18:41











  • _VERSION says 5.1

    – Tortex
    Mar 27 at 19:10











  • You might want to abandon this. The code references lua-users.org/wiki/SaveTableToFile which references TableSerialization which has loads of options

    – glenn jackman
    Mar 27 at 19:32











  • exportstring is some side function which is required (non-standard for lua).

    – val
    Mar 27 at 20:09











  • I can't reproduce your problem. Perhaps you inadvertently introduced the problem when putting the functions in the inputOutputTable table instead of the table table? The scope of exportstring is controlled by a do end block, it is required by both the save and load functions. A misplaced end could make it unavailable to one of the functions. (If you compiled/loaded the linked file as is, exportstring should not be a global access anyway.)

    – tehtmi
    Mar 28 at 6:18

















1















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.










share|improve this question


























  • I see "Lua 5.1 compatible" on that github page. What is your Lua version?

    – glenn jackman
    Mar 27 at 18:41











  • _VERSION says 5.1

    – Tortex
    Mar 27 at 19:10











  • You might want to abandon this. The code references lua-users.org/wiki/SaveTableToFile which references TableSerialization which has loads of options

    – glenn jackman
    Mar 27 at 19:32











  • exportstring is some side function which is required (non-standard for lua).

    – val
    Mar 27 at 20:09











  • I can't reproduce your problem. Perhaps you inadvertently introduced the problem when putting the functions in the inputOutputTable table instead of the table table? The scope of exportstring is controlled by a do end block, it is required by both the save and load functions. A misplaced end could make it unavailable to one of the functions. (If you compiled/loaded the linked file as is, exportstring should not be a global access anyway.)

    – tehtmi
    Mar 28 at 6:18













1












1








1








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.










share|improve this question
















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.







lua






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 27 at 18:20









Egor Skriptunoff

17.6k2 gold badges25 silver badges57 bronze badges




17.6k2 gold badges25 silver badges57 bronze badges










asked Mar 27 at 17:51









TortexTortex

1031 silver badge11 bronze badges




1031 silver badge11 bronze badges















  • I see "Lua 5.1 compatible" on that github page. What is your Lua version?

    – glenn jackman
    Mar 27 at 18:41











  • _VERSION says 5.1

    – Tortex
    Mar 27 at 19:10











  • You might want to abandon this. The code references lua-users.org/wiki/SaveTableToFile which references TableSerialization which has loads of options

    – glenn jackman
    Mar 27 at 19:32











  • exportstring is some side function which is required (non-standard for lua).

    – val
    Mar 27 at 20:09











  • I can't reproduce your problem. Perhaps you inadvertently introduced the problem when putting the functions in the inputOutputTable table instead of the table table? The scope of exportstring is controlled by a do end block, it is required by both the save and load functions. A misplaced end could make it unavailable to one of the functions. (If you compiled/loaded the linked file as is, exportstring should not be a global access anyway.)

    – tehtmi
    Mar 28 at 6:18

















  • I see "Lua 5.1 compatible" on that github page. What is your Lua version?

    – glenn jackman
    Mar 27 at 18:41











  • _VERSION says 5.1

    – Tortex
    Mar 27 at 19:10











  • You might want to abandon this. The code references lua-users.org/wiki/SaveTableToFile which references TableSerialization which has loads of options

    – glenn jackman
    Mar 27 at 19:32











  • exportstring is some side function which is required (non-standard for lua).

    – val
    Mar 27 at 20:09











  • I can't reproduce your problem. Perhaps you inadvertently introduced the problem when putting the functions in the inputOutputTable table instead of the table table? The scope of exportstring is controlled by a do end block, it is required by both the save and load functions. A misplaced end could make it unavailable to one of the functions. (If you compiled/loaded the linked file as is, exportstring should not be a global access anyway.)

    – tehtmi
    Mar 28 at 6:18
















I see "Lua 5.1 compatible" on that github page. What is your Lua version?

– glenn jackman
Mar 27 at 18:41





I see "Lua 5.1 compatible" on that github page. What is your Lua version?

– glenn jackman
Mar 27 at 18:41













_VERSION says 5.1

– Tortex
Mar 27 at 19:10





_VERSION says 5.1

– Tortex
Mar 27 at 19:10













You might want to abandon this. The code references lua-users.org/wiki/SaveTableToFile which references TableSerialization which has loads of options

– glenn jackman
Mar 27 at 19:32





You might want to abandon this. The code references lua-users.org/wiki/SaveTableToFile which references TableSerialization which has loads of options

– glenn jackman
Mar 27 at 19:32













exportstring is some side function which is required (non-standard for lua).

– val
Mar 27 at 20:09





exportstring is some side function which is required (non-standard for lua).

– val
Mar 27 at 20:09













I can't reproduce your problem. Perhaps you inadvertently introduced the problem when putting the functions in the inputOutputTable table instead of the table table? The scope of exportstring is controlled by a do end block, it is required by both the save and load functions. A misplaced end could make it unavailable to one of the functions. (If you compiled/loaded the linked file as is, exportstring should not be a global access anyway.)

– tehtmi
Mar 28 at 6:18





I can't reproduce your problem. Perhaps you inadvertently introduced the problem when putting the functions in the inputOutputTable table instead of the table table? The scope of exportstring is controlled by a do end block, it is required by both the save and load functions. A misplaced end could make it unavailable to one of the functions. (If you compiled/loaded the linked file as is, exportstring should not be a global access anyway.)

– tehtmi
Mar 28 at 6:18












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383640%2fattempt-to-call-global-a-nil-value-when-saving-tables-to-a-file-with-lua%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55383640%2fattempt-to-call-global-a-nil-value-when-saving-tables-to-a-file-with-lua%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해