Skip to content

Commit

Permalink
Fixed 'load_string' in core.lib.
Browse files Browse the repository at this point in the history
  • Loading branch information
aequabit committed Jan 19, 2016
1 parent d0fff55 commit aa5d13f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ end

-- Load Lua value from string.
function load_string (string)
return loadstring("return "..string)
return loadstring("return "..string)()
end

-- Read a Lua conf from file and return value.
Expand Down Expand Up @@ -700,6 +700,8 @@ function selftest ()
assert(true == equal({foo="bar"}, {foo="bar"}))
assert(false == equal({foo="bar"}, {foo="bar", baz="foo"}))
assert(false == equal({foo="bar", baz="foo"}, {foo="bar"}))
print("Testing load_string")
assert(equal(load_string("{1,2}"), {1,2}), "load_string failed.")
print("Testing load/store_conf")
local conf = { foo="1", bar=42, arr={2,"foo",4}}
local testpath = "/tmp/snabb_lib_test_conf"
Expand Down

0 comments on commit aa5d13f

Please sign in to comment.