MikuAuahDark's
before Lua got updated to 5.2, the function "loadstring" was exist however after update, the function (loadstring) deprecated but from then, function "load" can now work exactly same as loadstring.
the problem is, I have no idea about how to use this function. because originally
MikuAuahDark stated way to load is - use function "loadstring "1
2
3
2
3
f=io.open("pl_"..usgn..".txt","r")
PLAYERS[id]=loadstring("return "..f:read("*a"))()
f:close()
I tried similar ways to figure out but I have no idea.
and this code is mine that only just replaced loadstring to load.
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
function find_save()
	local f = io.open("ff.dat","r")
		if ( f ) then
		local s, temp = load("return "..f:read("*a"))
		temp = s() -- Problem : assign temp with function "s" results nil ;(
		unlock.main.intro.once = temp.intro.once
		f:close()
		return true
		end
	return false
end
So my question is - how can I assign variable "temp" from function s() ? without getting nil?
I think this error happens because of bad use of function "load", but I don't know how to use that function.
edited 1×, last 11.04.18 01:59:04 pm
[solved] Having issue in "load" function
1 
Offline
load - very specific function, you must provide a function that returns pieces of Lua code, those pieces are then put together