Jump to content




[LUA] [ERROR] Making a program inside of a program that contains varubles.


  • You cannot reply to this topic
5 replies to this topic

#1 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 01 December 2012 - 11:19 AM

I'm trying to make a save format that is a program itself, but get attempt to consentrate nil and string. It is in a function using the varubles that the function has (ex. function ex(var1, var2, var3)) and it writes in with fs.writeLine all on one line. How do I fix this?


CODE:
--DEVOLPING MODES--
devmode = true
--devmode will skip people talking.
savedev = true
--savedev will auto-save as what you enter opon start.
--DEVMODE CHECKS--
if savedev == true then
print("score level itemnum items name") ;
stuff = read()
failsodoafter = true
end
--FUNCTIONS(yes some of them are inside the code...)




--[[SAVING THE GAME]]--
function save( sscore, slevel, sitemnum, sitems, sname)
--sname is hanging off
--if fs.exists(""..sname.."") == true then
if devmode == false then

return fin
else
saveit = fs.open("testsave", "a")
saveitvar = { "loadingsave = true  score = "..sscore.." level = "..slevel.." itemnum = "..sitemnum.."" }
saveit.writeLine(saveitvar) 
saveit.close()
return fin
end
end

if failsodoafter == true then
save(stuff)
end








#2 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 01 December 2012 - 11:20 AM

It's because you assume that Chuck Norris will play nice with the other variables. In reality, he killed them all.

#3 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 01 December 2012 - 11:21 AM

-.- real help please, that was an example.

#4 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 01 December 2012 - 11:33 AM

-.- real code please, that was a joke.

#5 Geforce Fan

  • Members
  • 846 posts
  • LocationMissouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension

Posted 01 December 2012 - 11:47 AM

I posted the code now. Not the full code, just what's being executed. I am currently just testing this, I do the inputs on the read() thing myself with 1, 1, 1, etc.

#6 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 01 December 2012 - 11:57 AM

if failsodoafter == true then
save(stuff)
end

needs more args





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users