Lua 5.2 C Api Example

See Full List On Codeproject.com

Lua
winapi
basebuttonclass
basewindowclass
bitmappanel
buttonclass
checkboxclass
comboboxclass
controlclass
editclass
groupboxclass
labelclass
listboxclass
panelclass
radiobuttonclass
vobject
windowclass
binding
design
history

Native OS APIs
winapi
winapi.wglpanel
winapi.cairopanel
objc
xlib

Win32 windows & controls


Scope

Samsung sm j320p frp bypass. Windows, common controls and dialogs, message loop and system APIs.

Features

  • UTF8 Lua strings everywhere (also works with wide char buffers)
  • bitmap widget for custom painting
  • OpenGL and cairo custom-painting widgets (in separate packages)
  • anchor-based layout model for all controls
  • object system with virtual properties (win.title = 'hello' sets the title)
  • binding helpers for easy binding of new and future APIs
  • all calls are error-checked
  • automatic memory management (ownership; buffers)
  • flags can be passed as 'FLAG1 FLAG2'
  • counting from 1 everywhere.

Status

Current status and issues.

Hello World

Demos

Check out winapi_demo to see all the controls in action:

Also, many modules can be run as standalone scripts, which will showcase their functionality, so there’s lots of little demos there too.

Documentation

Architecture

  • winapi_design - hi-level overview of the library
  • winapi_binding - how the binding works, aka developer documentation
  • winapi_history - the reasoning behind various design decisions

Classes

  • VObject - objects with virtual properties
    • BaseWindow - base class for top-level windows and controls
      • Window - final class for top level windows
      • Control - base class for controls
        • Panel - custom-painted child windows
          • BitmapPanel - RGBA bitmap panels
            • CairoPanel - cairo panels
          • WGLPanel - OpenGL panels
        • Label - labels
        • BaseButton - base class for buttons
          • Button - push-buttons
          • CheckBox - checkboxes
          • RadioButton - radio buttons
          • GroupBox - group boxes
        • Edit - edit boxes
        • ComboBox - combo boxes and drop-down lists
        • ListBox - list boxes
        • [ListView][winapi.listviewclass] - list views
        • [TabControl][winapi.tabcontrolclass] - tab bars
        • [Toolbar][winapi.toolbarclass] - toolbars
      • [Tooltip][winapi.tooltipclass] - tooltips
    • [Menu][winapi.menuclass] - menus and menu bars
    • [NotifyIcon][winapi.notifyiconclass] - system tray icons

Functions

The “proc” layer is documented in the code, including API quirks and empirical knowledge, so do check out the source code.

Modules

bindinglast updated
winapi.bitmask Bitmask encoding and decoding 5 years ago
winapi.debug Strict mode and debug tools (optional module) 5 years ago
winapi.namespace Namespace module and utils 5 years ago
winapi.struct Struct ctype wrapper 2 years ago
winapi.util Binding utilities 19 months ago
winapi.wcs Utf8 <-> wide char conversions 19 months ago
winapi.init Main winapi module 19 months ago
winapi [doc] Win32 windows & controls 5 years ago
oo/abstractlast updated
winapi.basewindowclass [doc] Base class for windows and controls 17 months ago
winapi.controlclass [doc] Base class for controls 4 months ago
winapi.handlelist Handle to Lua object mapping 5 years ago
winapi.itemlist Base class for lists of objects 5 years ago
oo/controlslast updated
winapi.basebuttonclass [doc] Base class for button-like controls 22 months ago
winapi.bitmappanel [doc] RGBA bitmap panels 5 years ago
winapi.buttonclass [doc] Push-buttons 22 months ago
winapi.checkboxclass [doc] Checkboxes 5 years ago
winapi.comboboxclass [doc] Combo boxes and drop-down lists 22 months ago
winapi.editclass [doc] Edit boxes 22 months ago
winapi.groupboxclass [doc] Group boxes 22 months ago
winapi.labelclass [doc] Text labels 22 months ago
winapi.listboxclass [doc] List boxes 22 months ago
winapi.listviewclass Standard listview control 12 months ago
winapi.menuclass Standard menu control 22 months ago
winapi.notifyiconclass System tray icons 22 months ago
winapi.panelclass [doc] Custom-painted child windows 22 months ago
winapi.radiobuttonclass [doc] Radio buttons 5 years ago
winapi.tabcontrolclass Standard tab control 22 months ago
winapi.toolbarclass Standard toolbar control 22 months ago
winapi.tooltipclass Standard tooltip control 22 months ago
winapi.trackbarclass Trackbar control 17 months ago
winapi.waitemlistclass Accelerator item list 22 months ago
oo/oo-systemlast updated
winapi.class Single inheritance object model 19 months ago
winapi.vobject [doc] Object model for winapi windows and controls 22 months ago
oo/resourceslast updated
winapi.imagelistclass Image lists 5 years ago
oo/systemlast updated
winapi.mmdeviceclass Windows Multimedia Device API 5 years ago
oo/windowslast updated
winapi.windowclass [doc] Top-level windows 22 months ago
proc/controlslast updated
winapi.accelerator Accelerator tables 5 years ago
winapi.button Button and button-like controls 5 years ago
winapi.combobox Old combobox control 5 years ago
winapi.comboboxex Comctl32 combobox control 5 years ago
winapi.comctl Common controls API 5 years ago
winapi.edit Standard edit control 5 years ago
winapi.filedialogs Standard open and save dialogs 5 years ago
winapi.headercontrol Standard header control 5 years ago
winapi.listbox Standard listbox control 5 years ago
winapi.listview Standard listview control 12 months ago
winapi.menu Standard menu control 5 years ago
winapi.messagebox Standard message box dialog 5 years ago
winapi.richedit Standard richedit control 5 years ago
winapi.static Label/shape/image control 5 years ago
winapi.tabcontrol Standard tab control 5 years ago
winapi.toolbar Standard toolbar control 2 years ago
winapi.tooltip Standard tooltip control 2 years ago
winapi.trackbar Trackbar control 18 months ago
winapi.treeview Standard treeview control 5 years ago
proc/dialogslast updated
winapi.colorchooser Color chooser dialog 5 years ago
winapi.comdlg Common dialogs API 5 years ago
proc/gdilast updated
winapi.bitmap Bitmap API 5 years ago
winapi.ddev Display Devices API 5 years ago
winapi.devcaps Device capabilities API 5 years ago
winapi.dibitmap RGBA device independent bitmaps 5 years ago
proc/inputlast updated
winapi.keyboard Keyboard API 2 years ago
winapi.mouse Mouse API 5 years ago
winapi.rawinput Raw Input API 5 years ago
proc/multimedialast updated
winapi.dsound DirectSound API 22 months ago
proc/olelast updated
winapi.idataobject IDataObject interface 5 years ago
winapi.dragdrop Drag & drop OLE API 6 years ago
winapi.ienumformatetc IEnumFormatETC interface 5 years ago
proc/resourceslast updated
winapi.color Standard color brushes 5 years ago
winapi.cursor Cursor resources 3 years ago
winapi.font Font resources (the old API) 5 years ago
winapi.fontex Font resources (the new API) 5 years ago
winapi.icon Icon resources 5 years ago
winapi.imagelist Image lists 5 years ago
winapi.resource LoadImage API 5 years ago
proc/systemlast updated
winapi.clipboard Clipboard API 5 years ago
winapi.filemapping Memory mapped files 5 years ago
winapi.memory Memory Management API 5 years ago
winapi.mmdevice Windows Multimedia Device API 5 years ago
winapi.mmsystem Multimedia API 5 years ago
winapi.module LoadLibrary API 2 years ago
winapi.monitor Monitor API 5 years ago
winapi.ole OLE API 5 years ago
winapi.process Process API 19 months ago
winapi.propsys Property System API 5 years ago
winapi.registry Registry API 5 years ago
winapi.rpc RPC types 5 years ago
winapi.shellapi Shell32 API 5 years ago
winapi.spi System Parameters Info API 5 years ago
winapi.sstorage Structured Storage API 5 years ago
winapi.sync Synchronization API 22 months ago
winapi.sysinfo System Info API 5 years ago
winapi.systemmetrics System Metrics API 5 years ago
winapi.thread Threads API 19 months ago
winapi.time Time functions 5 years ago
winapi.uuid UUID API from rpcdce.h 5 years ago
winapi.winbase Winbase.h. incomplete :) 5 years ago
winapi.winnt Don't know the scope of this yet 5 years ago
proclast updated
winapi.volman Volume Management API 22 months ago
proc/windowslast updated
winapi.windowclasses WNDCLASSEX API 5 years ago
winapi.dpiaware DPI-awareness API 5 years ago
winapi.gdi GDI API 5 years ago
winapi.window Windows (as in HWND) API 12 months ago
winapi.wmapp User-defined (WM_APP+N) messages 19 months ago
testlast updated
winapi.showcase Testing utilities 5 years ago
typeslast updated
winapi.logfonttype LOGFONTW type 5 years ago
winapi.types C types from multiple headers 19 months ago
winapi.winuser Winuser types and macros from multiple headers 5 years ago


Last updated: 17 months ago Edit on GitHub

Package:winapi
Pkg type:Lua+ffi
Version: 3fe4770
Last commit:
License: Public Domain

Lua 5.2 C Api Example

GitHub - Hertogp/lua-capi-examples: Lua C API Example Collection

A Lua state is a C pointer to an opaque data structure. This structure knows everything about a running Lua environment, including all global values, closures, coroutines, and loaded modules. Virtually every function in Lua’s C API accepts a Lua state as its first parameter.

Lua Installation Guide

  • The Application Program Interface. LRM §4 describes the C API for Lua. This is used by NodeMCU modules written in the C source language to interface to the the Lua runtime. The header file lua.h is used to define all API functions, together with their related types and constants. This section 4 forms the primary reference, though the NodeMCU.
  • Lua comes with a free on-line reference manual for version 5.2 (which I am using) and Programming in Lua for version 5.0 is also available. There have been, however, a couple of changes between these versions that I cannot seem to be able to surpass. The changes are noted in the successive versions of the reference manual for 5.2 and 5.1.
  • May 30, 2019 The examples. Ex01, calling C-functions from Lua. Ex02, Lua's array example without metatable to check userdata type. Ex03, Lua's array example with metatable to check userdata type. Ex04, Lua's array example with object-like syntax on the Lua side. Ex05, OddlyEven, store anything, the hard way. Ex06, OddlyEven, store anything, the easy way.
  • A Lua state is a C pointer to an opaque data structure. This structure knows everything about a running Lua environment, including all global values, closures, coroutines, and loaded modules. Virtually every function in Lua’s C API accepts a Lua state as its first parameter.