Skip to content

Commit

Permalink
portuguese documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Nov 16, 2005
1 parent bdba8e7 commit 3aa499e
Show file tree
Hide file tree
Showing 6 changed files with 744 additions and 0 deletions.
207 changes: 207 additions & 0 deletions doc/br/examples.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>
LuaJava - ferramenta de scripts para Java</title> <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>

<body>

<div id="container">

<div id="product">
<div id="product_logo"><a href="http://www.keplerproject.org"><img alt="LuaJava" src="luajava_128.png"/></a></div>
<div id="product_name"><big><b>LuaJava</b></big></div>
<div id="product_description">Ferramenta de scripts para Java</div>
</div> <!-- id="product" -->

<div id="main">
<div id="navigation">

<h1>LuaJava</h1>
<ul>
<li><a href="index.html">In&iacute;cio</a>
<ul>
<li><a href="index.html#overview">Vis&atilde;o geral</a></li>
<li><a href="index.html#status">Status</a></li>
<li><a href="index.html#download">Download</a></li>
<li><a href="index.html#credits">Cr&eacute;ditos</a></li>
<li><a href="index.html#contact">Fale conosco</a></li>
</ul>
</li>
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#compile">Compila&ccedil;&atilde;o</a></li>
<li><a href="manual.html#install">Instala&ccedil;&atilde;o</a></li>
<li><a href="manual.html#console">Console Java</a></li>
<li><a href="manual.html#luareference">Refer&ecirc;ncia de Lua</a></li>
<li><a href="manual.html#javareference">Refer&ecirc;ncia de Java</a></li>
</ul>
</li>
<li><strong>Exemplos</strong></li>
<li><a href="history.html">Hist&oacute;rico</a></li>
<li><a href="license.html">Licen&ccedil;a</a></li>
<li><a href="http://luaforge.net/projects/luajava/">Projeto LuaForge</a></li>
</ul>
</div> <!-- id="navigation" -->

<div id="content">

<h2>Exemplos</h2>

<h4>Ol&aacute; Mundo usando LuaJava</h4>

<p>Este exemplo &eacute; um aplicativo simples Ol&aacute; Mundo que usa o LuaJava para imprimir de Lua e Java.</p>

<p><code>Hello.java</code></p>
<pre class="example">public class Hello
{
public static void main(String[] args)
{
LuaState L = LuaStateFactory.newLuaState();
L.openBasicLibraries();

L.doFile(&quot;hello.lua&quot;);

System.out.println(&quot;Ol&aacute; Mundo de Java!&quot;);
}
}
</pre>

<p><code>hello.lua</code></p>

<pre class="example">print(&quot;Ol&aacute; Mundo de Lua!&quot;)
</pre>

<h4>Acesso a um banco de dados</h4>

<p>Este exemplo usa o Java JDBC para acessar um banco de dados a partir de Lua.</p>

<p><code>TestJDBC.java</code></p>
<pre class="example">public class TestJDBC
{

public static void main(String[] args) throws Exception
{
// obt&eacute;m uma java.sql.Connection e cria uma instru&ccedil;&atilde;o

Class.forName(&quot;org.hsqldb.jdbcDriver&quot;);
Connection con = DriverManager.getConnection(
&quot;jdbc:hsqldb:hsql://localhost:9002&quot;,
&quot;sa&quot;, &quot;&quot;);
Statement st = con.createStatement();

try
{
st.execute(&quot;DROP TABLE luatest&quot;);
}
catch (Exception ignore) {}

st.execute([[CREATE TABLE luatest
(id int not null primary key,
str varchar, number double)]]);

for(int i = 0 ; i &lt; 10 ; i++)
{
st.executeUpdate(
&quot;INSERT INTO luatest (id, str, number) values(&quot; +
i + &quot;, '&quot; + 2*i + &quot;', &quot; +
System.currentTimeMillis() + &quot;)&quot;);
}

// cria um estado Lua e registra as bibliotecas b&aacute;sicas

LuaState L = LuaStateFactory.newLuaState();
L.openBasicLibraries();

// registra a instru&ccedil;&atilde;o no 'st' global

L.pushString(&quot;st&quot;);
L.pushObjectValue(st);
L.setGlobal();

// executa o arquivo testJDBC.lua

int err = L.doFile(&quot;testJDBC.lua&quot;);

L.close();
st.close();
con.close();
}
}
</pre>


<p><code>testJDBC.lua</code></p>
<pre class="example">do
-- testa se a instru&ccedil;&atilde;o do objeto &eacute; nil
if st == nil then
print(&quot;Erro. Objeto st &eacute; nil&quot;)
return
end

local st = st
_G.st = nil

function createSQLProxy(t)

local tableName = t

local function i (t,k)

local id = tonumber(k)
if not id then
return nil
end

local function mi (t,k)

local sql = &quot;select &quot;..k..&quot; from &quot;..
tableName..&quot; where id=&quot;..id
local rs = st:executeQuery(sql)
if not rs:next() then
rs:close()
return nil
end

local res = rs:getString(1)
rs:close()

return res
end

local res = {}
setmetatable(res, {__index = mi})
return res
end

local res = {}
setmetatable(res, {__index = mi})
return res
end

end


proxy = createSQLProxy(&quot;luatest&quot;)

print(proxy[1].str)
print(proxy[1].number)

</pre>

</div> <!-- id="content" -->

</div> <!-- id="main" -->


<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->

</body>
</html>
109 changes: 109 additions & 0 deletions doc/br/history.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>
LuaJava - ferramenta de scripts para Java</title> <link rel="stylesheet" href="http://www.keplerproject.org/doc.css" type="text/css"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>

<body>

<div id="container">

<div id="product">
<div id="product_logo"><a href="http://www.keplerproject.org"><img alt="LuaJava" src="luajava_128.png"/></a></div>
<div id="product_name"><big><b>LuaJava</b></big></div>
<div id="product_description">Ferramenta de scripts para Java</div>
</div> <!-- id="product" -->

<div id="main">
<div id="navigation">

<h1>LuaJava</h1>
<ul>
<li><a href="index.html">In&iacute;cio</a>
<ul>
<li><a href="index.html#overview">Vis&atilde;o geral</a></li>
<li><a href="index.html#status">Status</a></li>
<li><a href="index.html#download">Download</a></li>
<li><a href="index.html#credits">Cr&eacute;ditos</a></li>
<li><a href="index.html#contact">Fale conosco</a></li>
</ul>
</li>
<li><a href="manual.html">Manual</a>
<ul>
<li><a href="manual.html#compile">Compila&ccedil;&atilde;o</a></li>
<li><a href="manual.html#install">Instala&ccedil;&atilde;o</a></li>
<li><a href="manual.html#console">Console Java</a></li>
<li><a href="manual.html#luareference">Refer&ecirc;ncia de Lua</a></li>
<li><a href="manual.html#javareference">Refer&ecirc;ncia de Java</a></li>
</ul>
</li>
<li><a href="examples.html">Exemplos</a></li>
<li><strong>Hist&oacute;rico</strong></li>
<li><a href="license.html">Licen&ccedil;a</a></li>
<li><a href="http://luaforge.net/projects/luajava/">Projeto LuaForge</a></li>
</ul>
</div> <!-- id="navigation" -->

<div id="content">

<h2><a name="history"></a>Hist&oacute;rico</h2>

<dl class="history">
<dt><strong>1.0</strong> [22/jun/2005]</dt>
<dd>
<ul>
<li>aperfei&ccedil;oamento do tratamento de erros;</li>
<li>abandonada a compatibilidade com JDK 1.3;</li>
<li>bin&aacute;rios do Windows compat&iacute;veis com o LuaBinaries Release 2.</li>
<li>novo formato da documenta&ccedil;&atilde;o.</li>
</ul>
</dd>
<dt><strong>1.0 Beta 4</strong> [21/jan/2005]</dt>
<dd>
<ul>
<li>pacote renomeado como &quot;org.keplerproject.luajava&quot;;</li>
<li>LuaObject.getLuaState passou a ser p&uacute;blico;</li>
<li>nova fun&ccedil;&atilde;o LuaObject.type();</li>
<li>JavaFunction.foo() renomeado como JavaFunction.execute();</li>
<li>m&eacute;todo chamado por javaLoadLib passa a poder retornar um int.</li>
</ul>
</dd>
<dt><strong>1.0 Beta 3</strong> [21/set/2004]</dt>
<dd>
<ul>
<li>nova fun&ccedil;&atilde;o em lua luajava.loadLib, que abre bibliotecas para Lua escritas em Java;</li>
<li>fun&ccedil;&atilde;o LuaState.setGlobal passa a aceitar String, para funcionar como Lua setglobal;</li>
<li>JavaFunction.foo() gera uma LuaException;</li>
<li>nova fun&ccedil;&atilde;o LuaState.pushString(byte[]);</li>
<li>Problemas na vincula&ccedil;&atilde;o de algumas fun&ccedil;&otilde;es de lua ao Java;</li>
<li>corre&ccedil;&otilde;es de pequenos problemas.</li>
</ul>
</dd>
<dt><strong>1.0 Beta 2</strong> [07/jul/2004]</dt>
<dd>
<ul>
<li>passa a oferecer suporte a v&aacute;rios threads;</li>
<li>nova fun&ccedil;&atilde;o LuaState.close() que deve ser chamada para fechar o estado;</li>
<li>LuaState n&atilde;o tinha algumas fun&ccedil;&otilde;es;</li>
<li>corre&ccedil;&otilde;es de v&aacute;rios problemas.</li>
</ul>
</dd>
<dt><strong>1.0 Beta 1</strong> [28/jun/2004]</dt>
</dl>

</div> <!-- id="content" -->

</div> <!-- id="main" -->


<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="XHTML 1.0 v&aacute;lido!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->

</body>
</html>
Loading

0 comments on commit 3aa499e

Please sign in to comment.