This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local Button = @record{ | |
text: string, | |
on_mouse_down: function(btn: *Button, x: integer, y: integer), | |
} | |
## Button.value.is_widget = true -- related doc: https://nelua.io/overview/#specializing-concepts-for-records | |
-- let's create an alias to make this easier | |
local OnMouseDownCallback = @function(btn: *Button, x: integer, y: integer) | |
-- note: we don't need the `&` operator when binding a function to a variable/field, because |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- add modules compiled with luarocks on lua path (see the pallene file for details) | |
-- just replace YOUR_USER_HERE with your username | |
package.cpath = package.cpath .. ';/home/dreunix/.luarocks/lib/lua/5.4/?.so' | |
local teste = require 'codes.teste' | |
-- below the actual experiment, this is a port from Lua-SDL2 tutorial: | |
-- https://github.com/Tangent128/luasdl2/blob/master/tutorials/02-window/tutorial.lua | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- mod-version:2 -- lite-xl 2.0 | |
-- IMPORTANT NOTE: | |
-- This file it's just an archive, if you want to use nelua in lite-xl, use this instead: | |
-- https://github.com/AbdulKalam21/nelua-lite-xl/ | |
-- to better understand these comments, see this section from rxi's article | |
-- https://rxi.github.io/lite_an_implementation_overview.html#syntax_highlighting | |
-- first, we need to require the syntax module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generated by Nelua 0.2.0-dev */ | |
/* Compile command: gcc "libmylib.c" -o "libmylib" -Wall -fwrapv -g -lm */ | |
/* Compile hash: 3ubsTFvAUFqRHss7xDS1yGaiVwdM */ | |
/* ------------------------------ DECLARATIONS ------------------------------ */ | |
// moved to here: | |
#ifndef MYLIB_H | |
#define MYLIB_H | |
#ifdef __GNUC__ | |
#pragma GCC diagnostic error "-Wimplicit-function-declaration" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- based from https://github.com/edubart/nelua-lang/blob/master/lib/allocators/interface.nelua | |
-- a trait impl. can be just a macro which should receive a record as parameter | |
## local function sum_fields_trait(R) | |
-- ensure that the argument is really a record | |
##[[ staticassert( | |
R and R.value and R.value.is_record, | |
"parameter passed to 'sum_fields' is not a record" | |
)]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- estilos/estilos.css | |
html { | |
font-family: "Roboto Slab", sans-serif; | |
background-color: #00539F; | |
color: #461f02; | |
} | |
body { | |
width: 600px; | |
margin: 0 auto; |