Fix cart loading...?
It's not working but it's at least correctly loading. Just having issues, ya know, running the damn code.
This commit is contained in:
parent
098dd64e81
commit
e2a55bed98
|
@ -27,10 +27,9 @@ function Cart:loadCart(s)
|
|||
for _,s in pairs(split(love.filesystem.read(s))) do
|
||||
code = code..s.."\n"
|
||||
end
|
||||
code = "return (_update or function() end),(_draw or function() end)\n"
|
||||
local ok,err = pcall(loadstring,code)
|
||||
if not ok then error(err) end
|
||||
sandbox(err)
|
||||
code = code.."return (_update or function() end),(_draw or function() end)\n"
|
||||
local ok,err = pcall(loadstring,code,'t',sandbox())
|
||||
if not ok then print(err) return ret end
|
||||
update, draw = err()
|
||||
ret.update = update
|
||||
ret.draw = draw
|
||||
|
|
|
@ -8,7 +8,7 @@ function _G.sandbox(f)
|
|||
for k,v in pairs(api) do
|
||||
glob[k]=v
|
||||
end
|
||||
setfenv(f,glob)
|
||||
if f then setfenv(f,glob) else return glob end
|
||||
end
|
||||
local Cart = require("cart").Cart
|
||||
local cart
|
||||
|
|
Loading…
Reference in New Issue