Completed p1 in Lua